Docs / Federal tax
Federal tax engine documentation
QuantCalc computes each year's federal income tax with one engine: a 2026 Form 1040 composed from the year's income, rule by rule, in the order the form computes it. The planner uses it for every simulated year, and the federal tax API runs it on a single return. These pages document every step it takes, the form line each value lands on, the official source of each rule (158 distinct documents, each quote re-checked weekly) and the tests that prove it. Engine version 2.3.2.
What it computes
- Income: Form 1040 lines 2a to 8. Tax-exempt interest; IRA distributions and Roth conversions; Pensions and annuities; Social Security benefits; Taxable Social Security (the Pub 915 worksheet); Other ordinary income; Rental real estate: the passive activity loss limit (Form 8582); Rental real estate income or loss (Schedule E line 26, Schedule 1 line 5); Taxable interest (line 2b); Ordinary dividends (line 3b); Partnerships, S corporations, estates and trusts (Schedule E Parts II-III) and Form 8582's other passive activities.
- Capital gains: Schedule D netting. Net short-term gain or loss; Net long-term gain or loss; Combined net gain or loss; Capital-gain distributions (Schedule D line 13); 28% rate gain (Schedule D line 18); Unrecaptured section 1250 gain (Schedule D line 19); Line 7a: the net gain, or a net loss; Short-term capital loss carryover in (Schedule D line 6); Long-term capital loss carryover in (Schedule D line 14); Capital loss allowed (Schedule D line 21); Short-term capital loss carryover to next year; Long-term capital loss carryover to next year.
- Work income: wages, self-employment tax, the Additional Medicare Tax, tips, overtime and the QBI deduction. Wages (Form 1040 line 1a); Business income (Schedule 1 line 3); Self-employment tax (Schedule SE, Schedule 2 line 4); Deductible part of self-employment tax (Schedule 1 line 15); Self-employed retirement plan deduction (Schedule 1 line 16); Self-employed health insurance deduction (Schedule 1 line 17); Additional Medicare Tax (Form 8959); Excess social security tax withheld (Schedule 3 line 11); Employee payroll taxes (FICA), a standalone function; The Social Security earnings test, a standalone function.
- Total income and adjusted gross income. Adjustments to income (Form 1040 line 10); Total income; Adjusted gross income.
- Deductions: the standard deduction, §63(f) and the senior deduction. Standard deduction and the §63(f) aged amount; Additional standard deduction for blindness; The senior deduction (Schedule 1-A); Tips received in a trade or business (section 224(c)); No tax on tips (Schedule 1-A Part II); No tax on overtime (Schedule 1-A Part III); Qualified business income deduction (Forms 8995 / 8995-A); Additional deductions on line 13b; Total deductions; Taxable income.
- Tax: the brackets and the capital-gains worksheet. Tax: the brackets and the capital-gains worksheet; Tax: the Tax Table below $100,000; Tax: the Schedule D Tax Worksheet; Qualified dividends (line 3a).
- The alternative minimum tax and the foreign tax credit. Foreign tax credit without Form 1116 (the section 904(j) election); Foreign tax credit with Form 1116 (the section 904(a) limit, passive category); Alternative minimum tax (Form 6251); The AMT foreign tax credit (Form 6251 line 8).
- Credits: the credit for the elderly or disabled, the saver's credit, the child tax credit and the earned income credit. Form 1040 lines 18 to 22: the order of the nonrefundable credits; Credit for the elderly or the disabled (Schedule R); Saver's credit (Form 8880); Child tax credit, credit for other dependents and additional child tax credit (Schedule 8812); Earned income credit (Form 1040 line 27a); The premium tax credit (Form 8962) and the net credit (Schedule 3 line 9).
- Other taxes: §72(t) and the NIIT. The 10% additional tax on early distributions; Net investment income tax; Other taxes; Total tax; Total investment income (Form 8960 line 8); Net investment income: nonqualified annuities (Form 8960 line 3); Net investment income: rents (Form 8960 line 4a); Form 8960 line 9a: investment interest; Form 8960 line 9b: state income tax allocable to net investment income; Form 8960 line 12: net investment income; Excess advance premium tax credit repayment (Form 8962 line 29, Schedule 2 line 1a); Net investment income: the K-1 trade or business amounts (Form 8960 line 4b); Form 5329 Part III: excess traditional IRA contributions; Form 5329 Part IV: excess Roth IRA contributions; Form 5329 Part V: excess Coverdell ESA contributions; Form 5329 Part VI: excess Archer MSA contributions; Form 5329 Part VII: excess HSA contributions; Form 5329 Part VIII: excess ABLE contributions; Form 5329 Part X: excess Trump account contributions; Form 5329 Part XI: 100% of a distributed Trump account excess's earnings.
- Itemized deductions: Schedule A, §68 and the non-itemizer charitable deduction. Medical and dental expenses; State and local taxes paid; The SALT cap and its phase-down; Interest you paid; Gifts to charity: the percentage limits and the 0.5% floor; Gifts to charity: the five-year carryover; The §68 limitation on itemized deductions; Total itemized deductions; Itemize or take the standard deduction; Charitable deduction for non-itemizers.
- Retirement accounts: Form 8606 basis, Roth distributions, Form 5329 and the RMD. Form 8606: the nontaxable part of a conversion; Form 8606: the nontaxable part of all distributions; Form 8606: basis carried forward; Roth IRA distributions: ordering and the 5-year rules; Form 5329: early distributions; Form 5329: the exceptions to the additional tax; Form 5329: the missed-RMD excise tax; The RMD divisor: Uniform Lifetime or Joint and Last Survivor; The required minimum distribution; An inherited account: the payout rule and the distribution period; An inherited account: the year's required distribution; §72(q): the 10% on a nonqualified annuity before 59½; §72(q)(2): the annuity's exceptions.
- Estimated tax: the §6654 safe harbors and the Form 2210 penalty. Form 2210: the required annual payment; Form 2210: the underpayment by installment; Form 2210: the penalty; Form 2210 Schedule AI: the annualized income installment method.
- Later tax years: the projection beyond 2026. One amount in a later year; The year's brackets and deductions; The IRMAA income floors in a later year; The QCD limits in a later year.
In the planner (/api/simulate and the app) every simulated year runs the base return: the income, capital-gain, AGI, deduction, tax and other-tax steps, with the standard deduction, the §63(f) aged amount and the senior deduction (no blindness amount, no itemizing), taxable-account interest and dividends when the plan sets a taxable yield (it defaults to 0), and the capital-loss deduction with its carryover on each simulated path. The itemized-deduction, retirement-account and estimated-tax steps run on the federal tax API and in the library only: the planner's own required minimum distributions use the Uniform Lifetime Table on the household's combined traditional balance at the primary owner's age (a spouse's own IRA and employer plans are not split out by owner), and its §72(t) charge has no exceptions. The ACA bridge optimizer also applies the Roth ordering rules and the Joint and Last Survivor Table. The planner and the bridge compute line 16 on the rate schedules in every year, not the Tax Table the federal tax API uses below $100,000 (a difference of at most $6 in a year). In the planner a QCD is capped per IRA owner (a joint return with both spouses 70½ or older may exclude twice the limit; the indexed limit is rounded to the nearest $1,000), a separate filer who lived apart from the spouse all year pays IRMAA on the individual table, and the RMD divides the balance before the year's returns (engine 1.5.0). Federal engine 2.1: a Rental income life event is rental real estate on each year's return (Schedule E through Form 8582: the passive-activity loss limit with active participation, the carryforward on each path; net investment income; the state return takes Schedule E line 26 as other income, a loss down to that income's zero). The planner figures the credits in a year with wages or self-employment income (federal engine 2.2): the earned income credit without a qualifying child (it has no dependents; refundable, so the year's federal total can be a refund), the saver's credit on the plan's contributions of the year before retirement (the primary's; through 2026), and the credit for the elderly, which cannot lower the tax of a filer 65 or older on the standard deduction (PROP-F21-R-1); other years have no earned income and no contribution, so no credit.
The whole order, step by step: calculation order.
The 2026 parameters it uses
Read from the engine itself (GET /api/federal-tax/rules), not typed onto this page.
| Filing status | Standard deduction | §63(f) amount per person 65+ | NIIT threshold | Ordinary brackets |
|---|---|---|---|---|
| single | $16,100 | $2,050 | $200,000 | 7 brackets, 10% to 37% |
| married filing jointly | $32,200 | $1,650 | $250,000 | 7 brackets, 10% to 37% |
| married filing separately | $16,100 | $1,650 | $125,000 | 7 brackets, 10% to 37% |
| head of household | $24,150 | $2,050 | $200,000 | 7 brackets, 10% to 37% |
The senior deduction: $6,000 per individual 65 or older, tax years 2025 to 2028, reduced by 6% of MAGI over $75,000 ($150,000 joint); not on a separate return. The §72(t) additional tax: 10% of an IRA distribution taken before age 59½; without a birth month the engine charges the whole year in which the filer reaches 59 or less and nothing from the year the filer reaches 60, and with one only the part of the year before 59½ (how).
What it does not compute yet
A figure that leaves something out must say so. The engine does not model:
- Wages and self-employment beyond the W-2 and Schedule C amounts the API takes: farm income and the optional methods of Schedule SE, church employee income, railroad retirement (RRTA) compensation, unreported tips (Form 4137) and uncollected FICA (Form 8919), statutory employees; the QBI deduction's REIT dividends, publicly traded partnership income, qualified business loss carryforwards in and the agricultural cooperative (patron) reduction; every business is taken as one the filer materially participates in Source: IRS f1040sse.pdf (“Maximum amount of combined wages and self-employment earnings subject to social security tax”).
- Form 4952 investment-interest elections (the Schedule D Tax Worksheet lines 3 to 5 and 8, and the Qualified Dividends and Capital Gain Tax Worksheet's line 3); qualified dividends are taken to meet the holding-period test (more than 60 days in the 121-day period around the ex-dividend date, IRS Pub 550) Source: IRS i1040sd.pdf (“if you file Form 4952 and you have an amount on line 4g”).
- Credits other than the foreign tax credit, the credit for the elderly or disabled, the saver's credit, the child tax credit and credit for other dependents and the earned income credit: child and dependent care, education, energy and vehicle credits, the adoption credit, the general business credit, the prior-year minimum tax credit (Form 8801); the dependency, relationship, residency, identification-number and student tests of the credits are the caller's assertion; the EIC of a filer with foreign earned income, the Schedule 8812 Puerto Rico rules and nontaxable combat pay Source: IRS f8801.pdf (“Credit for Prior Year Minimum Tax”).
- Foreign tax credit and AMT limits: foreign income other than passive fund income (the general, section 901(j), treaty and lump-sum categories, foreign 25%/28% gains, Form 2555), interest expense apportionment (Form 1116 lines 4a-4b), foreign tax reductions and the high-tax kickout (lines 12-13), the carryback and reading back a carryover out, the AMT refiguring of capital gains and of Form 4952 (lines 2c and Part III) and the Form 6251 adjustments beyond private-activity-bond interest, incentive stock options and the caller's disposition and other adjustments Source: IRS i6251.pdf (“Simplified Limitation Election”).
- Adjustments to income (Schedule 1 Part II) other than the deductible part of self-employment tax, the self-employed retirement plan deduction and the self-employed health insurance deduction (lines 15-17); the Schedule 1-A car-loan interest deduction; the tips and overtime deductions' valid-SSN and qualifying-occupation conditions are the caller's assertion Source: IRS f1040s1.pdf (“Adjustments to Income”); IRS f1040s1a.pdf (“No Tax on Tips”).
- Private-foundation gift limits (and their carryover classes), the 0.5% floor on carryovers into 2026 and later as the IRS may read it (the engine applies it to the total, carryovers included), non-cash gifts other than long-term capital-gain property (ordinary-income property and the §170(e) reduction), and the §163(h)(3) mortgage-debt limit (mortgage interest is taken as a deductible amount); casualty and theft losses (Schedule A line 15, Form 4684); other itemized deductions (line 16) are taken as already limited (gambling losses up to winnings) Source: IRS f1040sa.pdf (“Casualty and theft loss(es) from a federally declared disaster”).
- The calculation of substantially equal periodic payments (the installment is an input), the other §72(t)(2) exceptions (first home, medical, birth or adoption, emergency, domestic abuse, terminal illness), the further Form 5329 exceptions (a qualified domestic relations order, health insurance while unemployed, higher education, an IRS levy, reservists, ESOP dividends, federal phased retirement, §414(w) and corrective distributions), the 25-years-of-service alternative to separation at 50, the 25% rate on a SIMPLE IRA distribution in its first 2 years (the engine uses 10%), and first-home or death Roth distributions Source: IRS i5329.pdf (“qualified domestic relations order”); IRS i5329.pdf (“IRS levy”); IRS i5329.pdf (“25 years of service”); IRS f5329.pdf (“include 25% of that amount on line 4 instead of 10%”).
- The §4974(d) reasonable-cause waiver of the missed-RMD excise and the still-working exception for an employer plan; one request carries one excise rate (a shortfall partly corrected and partly not cannot be sent at once) Source: law.cornell.edu IRC §401 (“April 1 of the calendar year following”); law.cornell.edu IRC §401 (“the calendar year in which the employee retires”).
- Form 2210's penalty waivers and the farmer and fisherman rules, Part II box E (a joint return in only one of the two years), Schedule AI for estates and trusts, and Schedule AI's period amounts of the items a request cannot split by period (Schedule A amounts, the AMT preference items, the credits' inputs and the rest accrue evenly through the year); the Schedule AI NIIT and Additional Medicare Tax are figured on the annualized amounts (the instructions give no other rule) Source: IRS f2210.pdf (“You filed or are filing a joint return for either 2024 or 2025, but not for both years”).
- A qualifying surviving spouse's eligibility (the year of death, the dependent child) is the caller's assertion; the split-interest QCD is an engine function, not a request field Source: IRS f1040.pdf (“Qualifying surviving spouse”).
- A spouse's death on a single return: the capital-loss carryover out is the joint return's; the decedent's share does not pass to the survivor (IRS Pub 550), so the caller enters the survivor's share as next year's carryover (the Monte Carlo planner splits it: spouseCapitalLossShare) Source: irs.gov/publications/p550 (“can be deducted only on the final income tax return filed for the decedent”).
- The balance due: withholding and estimated payments (read only by Form 2210), refundable credits (the earned income credit, the additional child tax credit, the refundable American opportunity credit, and the other Schedule 3 Part II items; excess social security withheld, Schedule 3 line 11, is reported but not netted), the refund and the amount owed (Form 1040 lines 25 to 37). The engine computes the total tax (line 24) and, on request, the Form 2210 penalty (line 38) Source: IRS f1040.pdf (“This is the amount you owe”); IRS f1040s3.pdf (“Excess social security and tier 1 RRTA tax withheld”).
- Schedule 2 taxes other than the §72(t) additional tax (and, federal engine 2.3, the §72(q) one and Form 5329's 6% and 100% taxes), the §4974 missed-RMD excise and the net investment income tax: household employment taxes, the HSA, Archer MSA and other account additional taxes, credit recaptures, the deferred-compensation (§409A, §457A) and installment-sale interest taxes, and the rest of Schedule 2 Source: IRS f1040s2.pdf (“Additional tax on HSA distributions. Attach Form 8889”); IRS f1040s2.pdf (“Household employment taxes. Attach Schedule H”).
- Form 5329 Part II (the additional tax on Coverdell ESA, QTP and ABLE account distributions), and around Parts III-VIII (federal engine 2.3): the deemed contribution of a prior excess absorbed by this year's unused limit (the IRA Deduction Worksheet, Form 8889 line 13: the engine has no traditional IRA or HSA deduction), Form 8889 itself (the HSA deduction, the 20% on distributions not used for medical expenses), the contributors' Coverdell MAGI limits, the Archer MSA limit and the ABLE-to-work amount (the caller's limits), a spouse's Coverdell ESA, Archer MSA, ABLE or Trump account, the 2025 Trump account excess (0 for 2026) and the excess-contribution limits of a projected year (refused) Source: IRS f5329.pdf (“Distributions included in income from a Coverdell ESA, a QTP, or an ABLE account”); irs.gov/pub/irs-dft/i5329--dft.pdf (“Also include on your 2026 Form 8889, line 13, the smaller of:”).
- Royalty income, Schedule E Parts IV-V (REMICs, farm rental), Form 4797 gains, farm income and personal-property rental: no field carries them into the net investment income tax (otherOrdinaryIncome and pension are never net investment income; a nonqualified annuity has its own field; rental real estate has rentalNetIncome, federal engine 2.1; partnerships, S corporations, estates and trusts the K-1 fields, federal engine 2.3) Source: law.cornell.edu IRC §1411 (“gross income from interest, dividends, annuities, royalties, and rents”); IRS f1040s1.pdf (“Rental real estate, royalties, partnerships, S corporations, trusts, etc.”).
- Other Schedule 1 income items with their own rules: the net operating loss deduction, hobby income, §951/§951A inclusions, the §461(l) excess business loss adjustment and digital assets received as ordinary income Source: IRS f1040s1.pdf (“Net operating loss”); IRS f1040s1.pdf (“Digital assets received as ordinary income”).
- The foreign earned income and housing exclusions (Form 2555) and the possession exclusions: MAGI is AGI throughout (the senior deduction, the NIIT, the SALT cap), and there is no Foreign Earned Income Tax Worksheet Source: IRS f1040s1.pdf (“Foreign earned income exclusion from Form 2555”).
- A filer or spouse who can be claimed as someone's dependent (the limited standard deduction), a dual-status alien, the Social Security lump-sum election (Pub 915 worksheets 2 to 4), the Form 8815 savings-bond interest exclusion and the other Pub 915 line 5 exclusions, repayments of benefits, a child's income on the parent's return (Form 8814), lump-sum distribution averaging (Form 4972), the retired public safety officer insurance exclusion and a pension's exclusion ratio for after-tax contributions (the pension field is the taxable amount) Source: IRS f1040.pdf (“Someone can claim”); IRS f1040.pdf (“You were a dual-status alien”); IRS f1040.pdf (“If you elect to use the lump-sum election method”).
- The senior deduction's valid-SSN condition is assumed met Source: law.cornell.edu IRC §151 (“social security number on the return”).
- Form 8606 line 4 (contributions made after the year end) and qualified disaster distributions and repayments (lines 15b, 15c, 25b); the carry-forward basis omits them Source: IRS f8606.pdf (“attributable to qualified disaster distributions”).
- Planner IRMAA: the MAGI add-backs other than tax-exempt interest (the savings-bond interest exclusion, foreign earned income, possession income), the three-year-old return when the two-year-old one is not available, and a new determination after a life-changing event (Form SSA-44): the planner always uses the MAGI of two years earlier Source: secure.ssa.gov/poms.nsf/lnx/0601101020 (“If MAGI in 2024 (or 2023 if 2024 is not available) was”); ssa.gov/forms/ssa-44.pdf (“life-changing event”).
- Planner RMDs per owner and per account: employer plans are not figured separately from IRAs, and a spouse's own IRA is distributed on the spouse's age, start age and divisor only when the plan gives the spouse's share of the traditional balance (traditionalBalanceSpouse); otherwise the planner takes one RMD on the household's combined traditional balance at the primary owner's age Source: irs.gov/publications/p590b (“separately for each IRA”).
- On Form 8960 Part II: foreign income tax and state or local property taxes attributable to net investment income (line 9b), miscellaneous investment expenses (line 9c), additional modifications (line 10) and the Form 4952 limit (investmentInterest is the deductible amount) Source: IRS f8960.pdf (“Miscellaneous investment expenses”).
- §72(q) beyond the 10% and its exceptions (federal engine 2.3): the recapture with interest of a series of substantially equal payments modified before 59½ or within 5 years (§72(q)(3)), the 5% rate on a deferred annuity under a pre-March 1, 1986 election, and a modified endowment contract's additional tax (§72(v)); the annuity's exclusion ratio (nonqualifiedAnnuity is the taxable part) Source: law.cornell.edu IRC §72 (“plus interest for the deferral period”); IRS p575.pdf (“5% rate on certain early distributions from deferred”).
- Substantially equal periodic payments from an employer plan, which §72(t)(3)(B) excepts only after the employee separates from service: seppDistribution is the IRA part, and the API refuses a seppDistribution that overlaps employerPlanDistribution Source: law.cornell.edu IRC §72 (“unless the series of payments begins after the employee separates from service”).
- Rental real estate beyond Schedule E Part I as one net amount, and Schedule E Parts II-III beyond one net amount per class (federal engine 2.3): royalties, REMICs (Part IV), farm rental (Form 4835), the release of a suspended loss on a disposition (section 469(g)) or at death, the commercial revitalization deduction, the per-activity allocation of the unallowed loss within a class (Form 8582 worksheets: each class is one activity), depreciation (an input inside the net amount) and its recapture, the at-risk rules (Form 6198) and the partner and shareholder basis limits (sections 704(d), 1366(d); Forms 7203/7217: the K-1 amounts are entered after them), the excess business loss limitation of section 461(l) (refused above its threshold), publicly traded partnerships, self-charged interest, the Form 1041 K-1 box 14 code H adjustment of Form 8960 line 7, a net operating loss, the rental real estate safe harbor of the QBI deduction (Rev. Proc. 2019-38), the AMT refiguring of passive losses, and the real estate professional's net investment income safe harbor (Treas. Reg. section 1.1411-4(g)(7)); Form 1116 line 3e takes the positive rental net income as gross income Source: IRS f8582.pdf (“Total losses allowed from all passive activities”).
- Inherited accounts beyond one account and one beneficiary: several beneficiaries of one account (the oldest's life expectancy, separate accounts) and trusts as beneficiaries (see-through trusts, applicable multi-beneficiary trusts) are the caller's to reduce to one beneficiary type; a successor beneficiary (the beneficiary of a beneficiary who died) and the 10-year limit after an eligible designated beneficiary's death; the surviving spouse's election to be treated as the decedent (SECURE 2.0 section 327), the spouse who dies before distributions begin, and the deemed election to treat the IRA as one's own; the decedent's basis (its own Form 8606) and a nonqualified distribution from an inherited Roth IRA; the 10-year election's deadline; the plan's own terms (a plan may require the 5-year or 10-year rule) Source: ecfr.gov/current/title-26/section-1.401(a)(9)-5 (“the applicable denominator is the greater of”).
- Form 8962 beyond Parts I-III for one tax family: the allocation of a policy shared with another tax family (Part IV), the alternative calculation for the year of marriage (Part V), a qualified small employer health reimbursement arrangement, a dependent's own Form 8962, the self-employed health insurance deduction together with the credit (refused), the special enrollment period and eligibility facts (other minimum essential coverage, affordable employer coverage, lawful presence; the caller's assertion), and a premium tax credit in a projected year (refused: the guidelines and percentages are not published) Source: IRS f8962.pdf (“Net PTC. If line 24 is greater than line 25, subtract line 25 from line 24”); IRS i8962.pdf (“Your SLCSP premium is the same for every month of 2025”).
The API has no field for any of these, and it refuses a request key it does not know (such as wages) with 400. It cannot
detect income, credits or taxes that are simply not sent: a household with wages, rental income or a foreign tax credit that sends only
the fields that exist gets a 200 with a tax that leaves them out, so a figure is complete only for a household whose whole return is
within the fields listed. Nor can it tell what an amount contains: a 28% rate gain sent as longTermGains is
taxed at the capital-gains rates, and where an input stands for a rule's result (deductible mortgage interest, a substantially equal
payment, a qualifying surviving spouse) meeting the rule's conditions is the caller's responsibility.
Later tax years
The engine's rules are 2026's. For a later year it moves each dollar amount the way its statute moves
it: the brackets, the standard deduction, its age-65 and blindness amounts and the capital-gain breakpoints are indexed from their
statutory base years by the chained CPI with the statute's rounding; the Net Investment Income Tax thresholds, the Social Security
taxation thresholds and the capital-loss limit are fixed in law and never move; the senior deduction ends after 2028 and the SALT cap
follows its enacted schedule. At a factor of 1 every indexed amount of a later year is its 2026 amount. The planner uses this projection for
every year after 2026, and the API takes projection (reference). Every amount, its rule
and its source: later years.
With the state engine
The state tax engine takes the federal figures some states need (the federal tax, federal taxable
income, the taxable part of Social Security) from this engine inside the planner. On the state tax
API, computeFederal: true does the same for a single request: see the API reference.
How it is verified
Every step has a unit test, the engine is held bit for bit to a recorded corpus of planner results, and every line and branch of its 5 source files is executed by its tests: verification.