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:
- 31-day test: at least 31 days present in the current year, and
- 183-day weighted test: a weighted total of at least 183 days, counting all current-year days, plus one-third of last year's days, plus one-sixth of the days two years ago.
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:
| Gate | You meet it if | You fail it if |
|---|---|---|
| 31-day test | 31+ days in the US this year | Fewer than 31 days this year (test not met, stop here) |
| 183-day weighted test | Weighted total is 183 or more | Weighted 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:
- Visa Waiver Program / ESTA: up to 90 days per visit, and you cannot extend or change status from it.
- B-2 tourist visa: admission is usually up to 6 months, but the exact period is set by Customs and Border Protection at entry.
- The controlling document is your I-94, not the visa stamp. Its "admit until" date is your actual permitted stay, and overstaying it can void your visa and trigger multi-year reentry bars.
- The tax line is separate and lower: because of the weighting, roughly 120 days a year (or 183 in a single year) can make you a tax resident under the SPT long before you hit any immigration limit.
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
- It counts the raw day totals you enter. Some days do not count at all: regular commuter days from Canada or Mexico, days in transit under 24 hours, days as a crew member, and days you could not leave for a medical condition that arose in the US. Subtract those before entering your totals.
- Days as an “exempt individual” (certain F, J, M, Q, A, and G visa holders) are excluded entirely and have their own rules.
- Even if you meet the test, the closer-connection exception (Form 8840) may let you remain a nonresident if you had fewer than 183 actual current-year days and a tax home abroad.
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?
Do all US days count toward the SPT?
I meet the SPT by days. Am I stuck with US tax residency?
How do I stay under the SPT as a frequent visitor?
Is the Substantial Presence Test the same as a state's 183-day rule?
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