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 —

…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:

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.

Rule text verified 2026-09-30
  • 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
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.