跳到正文
DEV Community· WhereMyRefund·· 1 小時前AI 評分51

用 30 行 Python 估算 IRS 分期付款計劃

Estimating an IRS payment plan in 30 lines of Python

AI 導讀

作者以 30 行 Python 編寫 IRS 分期付款估算器,可估算不同還款期限的月付款額及總成本。以 $8,500 餘額計算,6、24、60 個月方案的月供分別為 $1,458.34、$393.63、$181.28,總額分別為 $8,750、$9,447、$10,877。

正文

If you owe the IRS and can't pay in full, the payment plan pages tell you the rules but not the number most people want: how much will I pay each month, and how much more than the balance will it cost in total? The inputs are public, so you can estimate it yourself before applying.

This post builds a small estimator. It's meant for understanding the moving parts, not for replacing the IRS's own figures.

The four inputs

Interest. The IRS charges interest on unpaid tax at the underpayment rate, compounded daily. For individuals it was 7% a year for October to December 2026, and it's reset every quarter. IRS: Quarterly interest rates

The failure-to-pay penalty. Normally 0.5% of the unpaid tax for each month or part of a month. If you filed on time and have an approved payment plan, it drops to 0.25% a month while the plan is in effect. It never exceeds 25% of the unpaid tax. IRS: Failure to pay penalty

The setup fee. A short-term plan of 180 days or less has no setup fee. A long-term plan with automatic bank debit costs $29 online or $107 by phone, mail or in person. Without automatic debit it's $69 online or $178 otherwise. Low-income taxpayers pay less or nothing. IRS: Payment plans

Eligibility. Individuals can apply online for a long-term plan when they owe $50,000 or less in combined tax, penalties and interest, and for a short-term plan when they owe less than $100,000.

The code

Each month, the remaining balance grows by a month of daily-compounded interest plus the reduced penalty, then the payment comes off. To find the payment, search for the smallest even amount that brings the balance to zero by the last month.

def monthly_cost(balance, rate=0.07, penalty=0.0025, days=30.4):
    """Interest plus penalty added in one month on a remaining balance."""
    interest = balance * ((1 + rate / 365) ** days - 1)
    return interest + balance * penalty

def payment_for(balance, months, fee=0.0):
    """Smallest even monthly payment that clears the balance in `months`."""
    lo, hi = 0.0, balance * 2
    for _ in range(60):
        pay = (lo + hi) / 2
        b = balance + fee
        for _ in range(months):
            b = b + monthly_cost(b) - pay
        lo, hi = (pay, hi) if b > 0 else (lo, pay)
    return hi

for months in (6, 24, 60):
    p = payment_for(8500, months, fee=29 if months > 6 else 0)
    print(f"{months:>2} months: ${p:,.2f} a month, ${p * months:,.0f} in total")

For a balance of $8,500 it prints:

 6 months: $1,458.34 a month, $8,750 in total
24 months: $393.63 a month, $9,447 in total
60 months: $181.28 a month, $10,877 in total

Stretching the same balance from 2 years to 5 cuts the monthly payment by more than half and adds about $1,400 to the total. That trade-off is the main thing the estimate is for.

Where this model is simplified

  • It applies the penalty to the whole remaining balance. The IRS applies it to unpaid tax, so the real penalty is a little lower once interest makes up part of the balance.
  • It uses an average month of 30.4 days. Real interest follows the calendar.
  • It holds the rate at 7%. The IRS resets it every quarter, so a long plan will see several rates.
  • It ignores the 25% penalty cap, which only matters on very long plans.

Those shortcuts move the result by a few dollars a month, which is fine for comparing plan lengths and not fine for a payoff letter. The IRS's own balance is the one that counts.

A finished version

If you'd rather not run code, this IRS payment plan calculator does the same estimate with a month-by-month schedule. It uses the published rate for past quarters, the latest rate for future ones, and switches the penalty to 0.5% if the return was filed late. It's part of WhereMyRefund, an independent project that explains refund records and timing. It is not affiliated with the IRS.

Written with an AI agent and checked against the IRS pages linked above on November 23, 2026.

來源:DEV Community · dev.to