The substantial presence test decides whether the IRS taxes you as a US resident: 183 weighted days across three years. Here's the formula, two worked examples, and the exceptions.
The substantial presence test is how the IRS decides whether you're a resident alien (taxed on worldwide income, like a citizen) or a nonresident alien (taxed only on US income). The test: you're a resident if you were in the US at least 31 days in the current year and your weighted three-year total reaches 183 days — counting all of this year's days, one-third of last year's, and one-sixth of the year before.
It sounds mechanical, and mostly it is. But the exceptions — exempt-individual status for students, the closer-connection escape hatch, the green card override — are where real returns are won and lost. This post works through the formula with examples, then the exceptions. It pairs with The NRI's Complete Guide to US Taxes, which covers what happens after you cross the line.
You are a US tax resident for the year if both are true:
A day means any day you were physically present in the US at any time — arrival days count, and so does a one-hour layover where you clear immigration. A handful of narrow categories don't count (days you commute from Canada or Mexico, days in transit under 24 hours, days you couldn't leave due to a medical condition that arose here), but for most people the raw calendar governs.
Priya works for an Indian company and travels to the US repeatedly. Her US days: 120 in 2026, 120 in 2025, 120 in 2024. The math for 2026:
This is the classic pattern: about 120 days a year, every year, keeps you just under the line indefinitely. Add one more week per year and she'd tip over. Anyone managing recurring US travel should be counting days deliberately, not discovering the total in April.
Rohan moves to the US on July 1, 2026 for a new job, with no US days in 2024 or 2025. From July 1 through December 31 is 184 days:
But not for the whole year — his residency starts July 1, his first day of presence. That makes him a dual-status alien for 2026: nonresident from January through June, resident after. Dual-status returns have their own rules (no standard deduction, no joint filing, and elections that can beat both) — covered in our dual-status filing guide. Had Rohan arrived in September instead, he'd fall short of 183 and stay a nonresident all year, with a First-Year Choice election available to accelerate residency if that helps.
Certain visa holders are exempt individuals — not exempt from tax, but exempt from counting days. Their US days simply don't enter the formula:
When exempt status ends, the counting starts from zero days of history. A student who switches from F-1 to H-1B on October 1 typically has only about 92 countable days that year — under 183, so still a nonresident for the switch year. That timing quirk shapes the whole first H-1B return, which we walk through in our first-year H-1B tax guide.
Even if you cross 183 weighted days, you can still claim nonresident status if you were in the US fewer than 183 actual days in the current year, maintain a tax home in a foreign country, and have a closer connection to that country — measured by where your permanent home, family, belongings, bank accounts, and licenses are. You claim it by filing Form 8840 with the IRS. It's the safety valve for frequent visitors whose weighted total creeps over the line while their life clearly remains abroad. It is not available once you've applied for a green card.
The substantial presence test is only one of two doors into residency. If you hold a green card, you're a US tax resident, period — even if you spent zero days in the US that year. Day counting, closer connections, and treaty ties don't undo it (treaty tie-breaker claims exist but carry their own reporting and risks). Lawful permanent residents should assume worldwide taxation until the green card is formally abandoned.
Crossing into residency isn't just a different form. As a resident:
Count your days before the year ends, not at filing time. Residency is one of the few tax outcomes you can still steer in December.
The substantial presence test is arithmetic — 31 days minimum, 183 weighted days across three years — wrapped in exceptions that reward planning: exempt-individual years, the closer-connection escape, and elections for arrival years. Taxagon's CPAs and EAs run residency determinations and first-year returns for cross-border clients every season — if your day count is anywhere near the line, our NRI tax team can map it out with you.
This article is general information, not tax advice for your specific situation. Tax law changes; figures are for the years stated.
Talk it through with a licensed US tax professional — we'll tell you honestly whether it applies to your situation.

Beyond the obvious laptop and software: the home office rules that aren't scary, the vehicle method most people pick wrong, the self-employed health insurance deduction, and the retirement moves that dwarf everything else.

Permanent QBI, permanent 21% corporate rate, bigger QSBS — the 2026 rules changed the entity math for good. A practical framework for choosing (or switching), with the real numbers.

Equity compensation creates the most expensive tax surprises we see — under-withheld RSUs, double-taxed ESPP shares, phantom AMT from ISOs. How each type is really taxed, and the moves that protect you.