Calculate (or recalculate) the complete Form 1040 federal tax return line by line. Uses W-2 data and intake answers from a previous /ezfile:file-taxes session.
Compute the complete Form 1040 (or 1040-SR) for a single filer with W-2 income.
Before calculating, verify that return data exists:
./returns/ for W-2 data (either from a prior /ezfile:file-taxes session or manually entered)/ezfile:file-taxes <path-to-w2> first."Read these files before calculating:
reference/tax-year-2025.md -- brackets, standard deduction, key constantsreference/schedule-1a-2025.md -- Schedule 1-A deduction rules (if applicable)reference/credits-2025.md -- Saver's Credit and EIC rulesLine 1a = Sum of W-2 Box 1 from all W-2s
Line 1z = Line 1a (only W-2 income for this profile)
Line 9 = Line 1z (total income = wages only)
Only student loan interest applies for this profile:
IF student_loan_interest > 0:
raw = min(student_loan_interest, 2500)
MAGI = Line 9 (total income, before adjustments)
IF MAGI <= 85000:
deduction = raw
ELIF MAGI >= 100000:
deduction = 0
ELSE:
deduction = raw * (1 - (MAGI - 85000) / 15000)
deduction = round(deduction, 2)
Schedule_1_Line_21 = deduction
Schedule_1_Line_26 = deduction
Line_10 = deduction
ELSE:
Line_10 = 0
Line 11 = Line 9 - Line 10
This is the AGI -- the most important number on the return. It determines eligibility for credits and deduction phaseouts.
Calculate each applicable deduction with MAGI phaseout:
MAGI_for_1A = Line 11 (AGI)
# Phaseout function (shared by all Schedule 1-A deductions)
def apply_phaseout(amount, magi):
if magi <= 75000: return amount
if magi >= 100000: return 0
return round(amount * (1 - (magi - 75000) / 25000), 2)
# Tip deduction (Line 1)
tip_deduction = apply_phaseout(tip_income, MAGI_for_1A)
# Overtime deduction (Line 2)
overtime_deduction = apply_phaseout(overtime_pay, MAGI_for_1A)
# Auto loan interest (Line 3) -- max $10,000
auto_loan_deduction = apply_phaseout(min(auto_loan_interest, 10000), MAGI_for_1A)
# Senior deduction (Line 4) -- only if age 65+
IF age >= 65:
senior_1a_deduction = apply_phaseout(4000, MAGI_for_1A)
ELSE:
senior_1a_deduction = 0
Schedule_1A_Line_5 = tip_deduction + overtime_deduction + auto_loan_deduction + senior_1a_deduction
Line_12c = Schedule_1A_Line_5
IF age >= 65:
Line_12a = 17750 (single, 65+: $15,750 + $2,000 additional)
ELSE:
Line_12a = 15750 (single, under 65)
Line_12b = 0 (no charitable deduction for this profile)
Line_13 = 0 (no QBI deduction for W-2 filers)
Line_14 = Line_12a + Line_12b + Line_12c + Line_13
Line_15 = max(Line_11 - Line_14, 0)
Apply 2025 single filer brackets:
taxable = Line_15
if taxable <= 11925:
tax = taxable * 0.10
elif taxable <= 48475:
tax = 1192.50 + (taxable - 11925) * 0.12
elif taxable <= 103350:
tax = 5578.50 + (taxable - 48475) * 0.22
elif taxable <= 197300:
tax = 17651.00 + (taxable - 103350) * 0.24
elif taxable <= 250525:
tax = 40099.00 + (taxable - 197300) * 0.32
elif taxable <= 626350:
tax = 57131.00 + (taxable - 250525) * 0.35