How the Mexico sueldo neto calculator is verified

Inputs

InputFieldType
Sueldo bruto / mes (MXN)grossMonthlynumber

The formula

Each derived value below is computed by the Valem engine from the expression shown, in this order. Nothing else runs — there is no hidden code path.

Derived valueFieldFormula (JSONata)
IMSS (cuota obrera)imss$round(grossMonthly * $const.imssRate, 2)
ISR según tarifa art. 96isrTarifa($b := grossMonthly; $round($b <= 746.04 ? $b * 0.0192 : $b <= 6332.05 ? 14.32 + ($b - 746.05) * 0.0640 : $b <= 11128.01 ? 371.83 + ($b - 6332.06) * 0.1088 : $b <= 12935.82 ? 893.63 + ($b - 11128.02) * 0.1600 : $b <= 15487.71 ? 1182.88 + ($b - 12935.83) * 0.1792 : $b <= 31236.49 ? 1639.32 + ($b - 15487.72) * 0.2136 : $b <= 49233.00 ? 4005.46 + ($b - 31236.50) * 0.2352 : $b <= 93993.90 ? 8237.45 + ($b - 49233.01) * 0.3000 : $b <= 125325.20 ? 21665.72 + ($b - 93993.91) * 0.3200 : $b <= 375975.61 ? 31691.85 + ($b - 125325.21) * 0.3400 : 116912.87 + ($b - 375975.62) * 0.3500, 2))
Subsidio al empleosubsidio($s := grossMonthly <= $const.subsidioTope ? $const.subsidioMonto : 0; $round($s < isrTarifa ? $s : isrTarifa, 2))
ISR a retenerisr($x := isrTarifa - subsidio; $round($x > 0 ? $x : 0, 2))
Neto / mesnetMonthly$round(grossMonthly - imss - isr, 2)

Rates and thresholds

The expressions above read these as $const. They are the figures the annual refresh replaces, so they live as data rather than being written into the formulas — which is what makes a year-on-year change a one-line diff instead of an edit to arithmetic.

ConstantValue
imssRate0.025
subsidioMonto535.65
subsidioTope11492.66

Test vectors (3)

Every case is executed against this model on each build, by the Java engine and independently by a JavaScript one. A mismatch of a single cent fails the build, so the page cannot ship advertising a figure the model no longer produces.

Case 1 — S1 15,000 MXN — tramo del 17,92%, sin subsidio

given grossMonthly15000
expect imss375
expect isrTarifa1552.78
expect subsidio0
expect isr1552.78
expect netMonthly13072.22

Case 2 — S2 8,000 MXN — el subsidio al empleo casi anula el ISR

given grossMonthly8000
expect imss200
expect isrTarifa553.3
expect subsidio535.65
expect isr17.65
expect netMonthly7782.35

Case 3 — S3 60,000 MXN — tramo del 30%

given grossMonthly60000
expect isrTarifa11467.55
expect subsidio0
expect isr11467.55
expect netMonthly47032.45

Sources

Check it yourself — and reuse it

The whole model as JSON — inputs, outputs, formulas, vectors and sources in one re-runnable document.

This model is published under CC BY 4.0: use it, adapt it, build on it, with attribution. The licence covers the model — the expression of each rule and the arrangement of the catalog. The rates and thresholds are law, and nobody licenses those; the sources above are where they come from.

← Back to the Mexico sueldo neto calculator

Built with Valem — a live, verifiable calculator you can fork and embed.