SpyglassBeacon

FREE TOOL

Substantial Presence Test calculator

Enter the number of days you were physically present in the US in each of the last three years. The calculator applies the IRS weighting and tells you whether you meet the test. Everything runs in your browser. New to the test? Read the full explainer first.

THE FORMULA

Weighted days = (current-year days × 1) + (prior-year days × 1/3) + (two-years-ago days × 1/6)

You meet the Substantial Presence Test if you were in the US at least 31 days this year and your weighted days total 183 or more. Both conditions must be true.

Worked example

Say you spent 150 days in the US this year, 90 days last year, and 60 days the year before:

150 + (90 × 1/3) + (60 × 1/6) = 150 + 30 + 10 = 190 weighted days

That is over 183, and the 150 current-year days clear the 31-day gate, so this person meets the test and is a US resident alien for tax purposes. Drop this year to 120 days and the total falls to 160, under the line.

How the Substantial Presence Test works

You are treated as a US resident alien for tax purposes if you meet both of these tests for the year:

The weighting is why far fewer than 183 actual days can trigger it. The IRS's own example: 120 days in each of three years works out to 120 + 40 + 20 = 180 weighted days, which does not meet the test. Any part of a day present counts as a full day.

Do I pass? The two-gate decision

You are a resident alien for tax purposes only if you clear both gates. Fail either one and you do not meet the test:

GateYou meet it ifYou fail it if
31-day test31+ days in the US this yearFewer than 31 days this year (test not met, stop here)
183-day weighted testWeighted total is 183 or moreWeighted total is 182 or less

Meet both: you are a US resident alien, taxed on worldwide income, and typically file Form 1040 (the first year is often a dual-status year). Meet the days but had under 183 actual current-year days with a tax home abroad: you may still escape via the closer-connection exception (Form 8840). Fail either gate: you are a nonresident alien for the year and generally file Form 1040-NR.

How many days can I stay in the US?

Two separate limits answer this, and people mix them up. Immigration sets how long you are allowed to be here; tax (the SPT) sets when your presence makes you a resident:

So "how many days can I stay" has two answers: check your I-94 for the immigration limit, and use the calculator above for the tax one.

Important limits of this calculator

Not the same as a state's 183-day rule

This federal test is easy to confuse with a state's statutory-residency threshold, but they're unrelated: a state (New York, California) counts actual days in that state over one year, more than 183 triggers it, and the days involved are irrelevant everywhere else. The SPT counts days in the US as a whole over three years, weighted, and decides federal tax residency, not state. You can trip one, both, or neither. If it's a state day count you're after, use the 183-day rule calculator instead.

Frequently asked questions

Updated 2026-08-26

What is the Substantial Presence Test?
The IRS test that makes a non-citizen a US tax resident by day count: at least 31 days in the US this year, and a weighted total of 183 using all of this year's days, one third of last year's, and one sixth of the year before.
Do all US days count toward the SPT?
Most do, including partial days, but there are exemptions: days as an F or J student or teacher within the exempt window, days you could not leave for a medical condition that arose in the US, and regular Canada or Mexico commuter days, among others.
I meet the SPT by days. Am I stuck with US tax residency?
Not necessarily. With fewer than 183 actual days in the current year, a tax home abroad, and a closer connection to that country, you can file Form 8840 and be treated as a nonresident. Treaty tie-breakers can also apply.
How do I stay under the SPT as a frequent visitor?
Plan around roughly 120 US days a year: at that steady pace the weighted three-year total stays just under 183. The calculator above shows your maximum safe days for the current year given your prior two years.
Is the Substantial Presence Test the same as a state's 183-day rule?
No. The SPT is a federal test on days anywhere in the US, weighted over three years. A state's 183-day statutory-residency rule counts actual days in that one state over a single year. They run independently, and meeting or missing one says nothing about the other.

Not tax advice. Residency is fact-specific and this tool cannot account for every exclusion. Confirm your situation with a qualified advisor.

Source: IRS, Substantial Presence Test.

Embed this calculator

Free to drop into your own site. It runs entirely in the visitor's browser — nothing is sent anywhere. Copy this snippet:

<iframe src="https://spyglassbeacon.com/embed/substantial-presence-test-calculator" width="100%" height="420" style="border:1px solid #E2E8F0;border-radius:12px" title="Substantial Presence Test calculator" loading="lazy"></iframe>

Please keep the "Powered by SpyglassBeacon" link shown in the embed.

Not sure how many days you actually spent here?

SpyglassBeacon counts your US days automatically, so next year's number is already done.

Get the app