US tax residency rules: the Substantial Presence Test, explained properly
Most "US 183-day calculator" pages show a single number. The statute does not. The Substantial Presence Test is a two-part test with a three-year memory, a list of days that never count, and two escape hatches. Here is how it actually fits together — with the statutory citations.
The two-part test
Under IRC §7701(b)(3), an alien is a US resident for tax purposes if they meet the Substantial Presence Test for the calendar year. The test has two parts, and both must be satisfied:
- The 31-day floor. You were physically present in the US on at least 31 days during the current calendar year.
- The weighted 3-year formula. The sum of —
- all the days you were present in the current year, plus
- ⅓ of the days you were present in the first preceding year, plus
- ⅙ of the days you were present in the second preceding year,
…reaches at least 183 days. Both parts matter: 400 weighted days with only 25 days of current-year presence does not make you resident, because the floor fails.
Why the weighting matters more than the headline number
The formula is what separates a rough estimate from a real answer. Because a third of last year and a sixth of the year before still count, heavy presence keeps "charging" against you for two years. Three consecutive 120-day years produce a weighted total of 120 + 40 + 20 = 180 — one day under. That is IRS Publication 519's own worked example: a single extra day in the third year flips the result. Someone planning around "183 days a year" without the formula can cross the line without ever spending 183 days in any one year.
The practical consequence for planning: your remaining safe days this year depend on what you did in the previous two. A calculator that asks only for this year's days cannot give you an answer — which is why ours takes a travel ledger and computes the weighted total with the exact fractional arithmetic (⅓ and ⅙ are handled as exact integers internally: the test is equivalent to 6·current + 2·prior₁ + prior₂ ≥ 1098).
Days that never count at all
Certain days of physical presence are excluded from every part of the formula:
- Exempt individual days. F, J, M and Q visa holders — students for up to 5 calendar years, teachers and trainees for 2 of the prior 6 years — are "exempt individuals". Their days of presence do not count. This is why many international students only become countable in later years.
- Regular commuters from Canada or Mexico, when commuting is more than 75% of their workdays.
- Transit days — present less than 24 hours while travelling between two places outside the US (the classic connecting-flight case).
- Medical condition days — you intended to leave but a medical condition that arose while present prevented it.
Our calculator does not yet model these exclusions from a ledger alone; the US page lists them as caveats. If they apply to you, your true counted days are lower than shown.
Escape hatch 1: the Closer Connection Exception
Meeting the weighted formula does not end the analysis. If you were present fewer than 183 days in the year itself, maintained a tax home in a foreign country, and had a closer connection to that country than to the US, you can remain a nonresident by filing Form 8840 on time. You cannot use it if you applied for a green card or otherwise took steps toward US residence.
Escape hatch 2: first-year and last-year elections
The year you arrive in or depart from the US can be split. First-year residents may elect a residency starting date that ignores pre-arrival days; departing individuals may end residency on the date of departure if they connect with a foreign country. These elections are fact-specific and are not modelled by a day calculator — but they change the day count itself, so they belong in a conversation with a cross-border adviser.
Check your own numbers
The US tax residency calculator applies exactly the rules above — floor, weighted formula, exact arithmetic, remaining safe days — to your travel ledger, and runs the same trips against 12 other countries' tests in one pass. For the contrast with other systems, see the 183-day rule compared and the UK Statutory Residence Test explained.
- IRC §7701(b) — (b)(2) substantial presence test; (b)(3) weighted 3-year formula — official text
- IRS Publication 519 (2025), Chapter 1 — The Substantial Presence Test (worked examples) — official text
- IRS Form 8840 — Closer Connection Exception Statement — official page