Urgent.News

What's breaking now, across hundreds of outlets.

Tech

IFTA fuel tax in Python: fleet MPG, taxable gallons and credits on one return

A common shortcut for the quarterly IFTA return is miles in a state times that state's rate. The return works differently: One fleet MPG : total miles everywhere / total gallons bought everywhere, rounded to 2 decimals. Taxable gallons per state come from where you drove: state miles / MPG, rounded to whole gallons. Net gallons = taxable gallons - gallons bought in that state. Negative means…

The IFTA (International Fuel Tax Agreement) fuel tax system calculates tax liability based on a fleet's miles driven and gallons of fuel purchased. To determine tax, the system takes total miles driven divided by total gallons purchased, rounding the result to two decimal places. This yields the fleet MPG rate.

Taxable gallons per state are calculated by dividing miles driven in that state by the fleet MPG rate, rounded to the nearest whole gallon. The difference between taxable gallons and gallons purchased in a state represents the net amount, which may be a credit if net is negative.

The tax for each state is calculated by multiplying net gallons by the state's tax rate. Total tax liability is the sum of taxes for each state. Importantly, rounding the fleet MPG first ensures it's used consistently across all state calculations. Some states may add surcharges on taxable gallons, which should be calculated separately.

Real-world IFTA rates fluctuate each quarter, and a detailed state-by-state calculator is available online for free.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Report a problem with this story

Get the day's news by email. Daily, weekly or monthly. Sign up

More in Tech

EDUCATION INNOVATION: New career guidance app helps matriculants choose their next step

A free mobile app developed by a University of Cape Town student is helping learners in under-resourced communities explore courses they qualify for, understand their career interests and see how…

  • Guideian EDU app helps South African matriculants choose careers
  • Learners input marks, complete psychometric test for personalized recommendations
  • App aims to expand to small towns and partner with schools for equal access

More from Wednesday, 2 December 2026 →