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:

  1. The 31-day floor. You were physically present in the US on at least 31 days during the current calendar year.
  2. 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. Qualifying students temporarily present under F, J, M or Q status, and qualifying teachers or trainees under J or Q status, may exclude days subject to compliance and calendar-year limits. Students generally use a five-calendar-year limit; teachers and trainees have a different lookback test. A visa label alone is not enough to decide eligibility.
  • 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.

The travel ledger counts physical presence. Use the separate SPT calculator with confirmed exclusions to review student/teacher history and compare adjusted annual totals, without changing the original ledger.

Review the student and teacher limits, Form 8843 requirements and an exclusion example →

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.

Residency starting and ending dates

Meeting a residence test and deciding the period of residence are separate steps. The IRS starting and ending date rules include a first-year choice for some people who meet the SPT in the following year, and conditions for an earlier termination date when leaving. These rules do not simply deduct travel days from the SPT formula. They are fact-specific and are not modelled by this calculator.

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 the other supported jurisdictions in one pass. For the contrast with other systems, see the 183-day rule compared and the UK Statutory Residence Test explained.

Rule text verified 2026-09-30
Informational only — not tax advice. Based on the published tests, the calculator tells you what appears to follow; elections, treaties and visa facts can change the outcome. Confirm with a qualified cross-border tax adviser.