Your visa doesn’t decide how the IRS taxes you. A day count does.
Get that count wrong and you file the wrong return, miss reporting you owed, or report accounts you never needed to. The substantial presence test calculator below runs the IRS formula exactly as published, and the rest of this page explains what the number means.
Written by Aradhana Sharma. Every rule here is quoted from the IRS page on the test, retrieved 11 September 2026. I’m not a CPA, and the exceptions at the bottom are where you stop reading and call one.
Count your days
Physical presence in the US, any part of a day counts. Nothing is stored or sent anywhere.
At least 31 days this year
At least 183 weighted days
Applies the IRS formula only. It can’t see exempt-individual status, treaty positions or the closer connection exception, all covered below. Orientation, not advice.
What is the substantial presence test
It’s the IRS method for deciding whether you count as a US resident for tax purposes. Residency here has nothing to do with immigration status, which is the source of most of the confusion.
The IRS states it plainly. You’re considered a United States resident for tax purposes if you’re physically present on at least 31 days during the current year, and 183 days during the 3-year period that includes the current year and the 2 years immediately before it.
Both conditions. A year spent almost entirely in the US still fails if the current-year count is under 31, and a long history of visits fails if the weighted total falls short. That’s what the two ticks in the calculator are checking separately.
How the weighting works, and why it surprises people
Not every day counts equally. The three years are weighted, and the older ones count for less.
All days in the current year count in full. Days in the first year before count at one third. Days in the second year before count at one sixth. Anyone working out how the substantial presence test works for the first time usually misses this and adds three raw numbers together.
The IRS publishes its own example, and it’s the clearest illustration of why the weighting matters.

Three identical years of 120 days produce a weighted total of 180. Three short of the threshold, and the person isn’t a resident under the test. Add four more days to the current year and the answer flips. That margin is why the count is worth doing properly rather than estimating.
Days that do not count
You’re treated as present on any day you’re physically in the country at any time during that day. A two-hour layover in Newark is a day. Landing at 11pm is a day.
The IRS lists exceptions to that, and two matter to most readers here. Days you’re in the US for less than 24 hours while in transit between two places outside the country do not count. Neither do days you commute to work from a residence in Canada or Mexico, if you regularly commute.
The larger exception is the exempt individual category, and it changes the answer completely for a lot of people.
A substantial presence test calculator for F1 students needs a caveat
This is the single biggest caveat on the page, and it’s why any tool aimed at F1 students needs a warning attached rather than a number.
The IRS excludes days of presence for exempt individuals, and that category includes a student temporarily present in the US, along with a teacher or trainee temporarily present. If you fall inside it, those days come out of the count entirely, which can leave you a nonresident despite being here the whole year.
So an F1 student running these numbers can get a result that’s arithmetically correct and practically wrong. The rules on how long that exemption lasts, and what happens when it runs out, sit in IRS Publication 519. I’m not going to summarise the durations here, because they differ by category and getting one wrong would send somebody down the wrong filing path for a whole year. Read the publication or ask a professional.
The practical version for students: run the numbers by all means, then treat the result as provisional until you’ve confirmed whether your days are excluded. A calculator can’t know your category, and this one doesn’t pretend to.
The closer connection exception
There’s one more route out, and it applies even when the arithmetic says resident.
The IRS conditions for a closer connection state that even if you meet the substantial presence test you can still be treated as a nonresident if you qualify. It exists for people whose real ties, home, family, and affairs, remain in another country despite the day count.
It has conditions and it requires filing to claim, so it isn’t something to assume. What matters is knowing it exists, because plenty of people meet the day count in a transition year and never learn there was an alternative.
What the answer actually changes
This is why the count matters rather than being trivia.

A resident for tax purposes is taxed on worldwide income. Rent from a flat in Pune, interest on an Indian fixed deposit, dividends from an Indian mutual fund, all of it becomes reportable. A nonresident is generally taxed only on US-source income, which is a very different return.
The reporting obligations move with it. Once you’re a resident, foreign accounts crossing $10,000 in aggregate at any point in the year trigger a separate filing with FinCEN, covered in the FBAR guide. The wider picture of what gets filed where is on the main guide.
Retirement accounts are affected too. How a distribution is taxed depends on your residency at the time, which is one of the moving parts in the guide on 401(k)s for H1B holders. And if you’re weighing up side income, the authorisation question comes before any of this, with the tax on it after.
Counting your days without guessing
Most people estimate, and most people are wrong by a week or more.
Your passport stamps are the obvious source and the least reliable, because not every entry gets stamped cleanly. Airline booking history is better. Best of all is the official CBP travel history record, which lists arrivals and departures and is free to look up.
Build the list once, keep it in a note, and add to it each time you travel. It takes ten minutes a year and it removes the single most common source of error in this whole calculation. Keeping it alongside your account records makes the January account routine a short job rather than an afternoon.
Common questions
What does the substantial presence test mean for someone who just arrived?
In your first partial year you may fall short of 183 weighted days and file as a nonresident, then become a resident the following year. Transition years have their own rules and are worth paying somebody to handle once.
Does the substantial presence test for tax purposes look at my visa at all?
Only in the sense that some categories make you an exempt individual whose days aren’t counted. Otherwise the test is pure arithmetic on physical presence, and an H1B, an L1 and a green card holder all run the same numbers.
Does the 2026 result differ from previous years?
The substantial presence test formula is the same in 2026 as before, and the calculator above simply counts whichever three years apply to you. What changes is the window, so the same person can pass one year and fail the next purely because an older high-count year has dropped out of it.
Do weekends and holidays count?
Yes. Any day you were physically in the country counts, regardless of what you were doing. Presence is the test, not activity.
What if I was here on two different visas in one year?
The days still count, though a period spent as an exempt individual may be excluded. Split years get complicated quickly and are a good reason to involve a professional.
Can I be a resident for tax and a nonresident for immigration at the same time?
Yes, and most people reading this are exactly that. The two systems use the same word for different things, which is why the confusion is so persistent.
Where do I find my official entry and exit dates?
US Customs and Border Protection publishes a travel history lookup covering arrivals and departures. It’s free, and more reliable than passport stamps.
Before you rely on the number
The calculator applies the published formula and nothing else. It can’t see whether you’re an exempt individual, whether a treaty position applies, or whether the closer connection exception is open to you.
For a clear-cut case, several years in the country on a work visa with no student history, the arithmetic is the answer. For a first year, a departure year, a student category, or anything involving two countries claiming you at once, pay somebody. An hour of professional time costs less than a year filed on the wrong basis.
Nothing here is tax advice. The sourcing rules behind every figure are in the editorial policy, and the limits of what this site can tell you are in the disclaimer. If the IRS changes the formula, tell me through the contact page and this page gets updated.



Pingback: Self employment tax calculator with deductions, 2026 rates
Pingback: SEP IRA vs Solo 401(k): the 2026 contribution comparison
Pingback: Moving back to India from USA: the money checklist
Pingback: Forgot to file an FBAR? What actually happens next
Pingback: FICA withheld on OPT? How to get your FICA tax refund
Pingback: Filed a 1040 instead of a 1040NR? How to fix the return
Pingback: H4 EAD RFE response time: the 12-week rule explained
Pingback: Forgot to file Form 8938? Penalty, relief and what to do