If you spend meaningful time in the United States without being a citizen or green card holder, one arithmetic question decides how the IRS treats you. Not your visa. Not your intent. Not where you call home. A day count.

Get it wrong in one direction and you file as a nonresident when the IRS considers you a resident. Get it wrong in the other and you declare your worldwide income to a country that had no claim on it.

The test in one sentence

You meet the Substantial Presence Test for a calendar year if you were physically present in the United States on at least 31 days during that year, and on at least 183 weighted days across that year and the two years before it.

Both conditions. The second one is where the trouble lives.

The weighting is the whole thing

The 183 days are not 183 days. The IRS counts a day differently depending on how long ago it was:

YearEach day counts as
Current year1 full day
First year before1/3 of a day
Second year before1/6 of a day

So a day you spent in the US two years ago still counts — it just counts less. This is what makes the test a rolling three-year measurement rather than an annual one, and it is why people who feel they have cut back their US time can still cross the line.

A worked example that passes

Someone spends 120 days in the US this year, 150 last year, and 150 the year before:

  • Current year: 120 × 1 = 120
  • Last year: 150 × 1/3 = 50
  • Year before: 150 × 1/6 = 25
  • Weighted total: 195

195 is above 183, and 120 is above 31. Both conditions met. This person is a US tax resident for the year — despite never once spending half a year there, and despite spending fewer days this year than in either of the two years before.

The version that catches people out

The trap is the year you deliberately cut back. Say you spent 180 days in each of the two prior years, then pulled your current-year presence down to 90 days specifically to stay under the line:

  • Current year: 90 × 1 = 90
  • Last year: 180 × 1/3 = 60
  • Year before: 180 × 1/6 = 30
  • Weighted total: 180

180 is under 183. This person is not a resident — by three days. Add one more week in the US and they would be. Nothing about the current year felt like a half-year stay, and the margin came down to a long weekend.

That is the practical reason to count before you travel rather than after. By the time you are filing, the days are already spent.

Run your own dates through the US Substantial Presence Test Calculator — it shows each year's contribution separately, so you can see which year is pushing you over rather than just the total.

Days that do not count

You are treated as present on any day you were physically in the United States at any time during that day. Arrival and departure days both count in full. There is no half-day arithmetic.

The IRS excludes a specific, closed list of days:

  • Regular commuting from Canada or Mexico. Days you commute to work in the US from a residence in Canada or Mexico, if you regularly commute.
  • Transit under 24 hours. Days you are in the US for less than 24 hours while travelling between two places outside the United States.
  • Crew members of a foreign vessel.
  • Medical conditions that arise while you are there. Days you could not leave because of a medical condition that developed while you were in the United States. A condition you arrived with does not qualify.
  • Days as an exempt individual — the big one, below.

Note what is not on that list: holidays, business trips, days spent visiting family, days you were in the country but working for a foreign employer. Those all count.

Exempt individuals

Some people's days do not count at all, no matter how many there are. This is not an exemption from tax — it is an exemption from the day count, which is a different and more powerful thing.

Four categories qualify:

  • Foreign government-related individuals on A or G visas, other than A-3 and G-5.
  • Teachers and trainees on J or Q visas who substantially comply with the visa's requirements.
  • Students on F, J, M or Q visas who substantially comply.
  • Professional athletes competing in a charitable sports event.

The student and teacher categories have time limits, and this is where people are caught by surprise years later:

  • Students stop being exempt once they have been exempt as a student, teacher or trainee for any part of more than 5 calendar years. Note "any part of" — a single day in January burns the whole year.
  • Teachers and trainees are not exempt if they were exempt for any part of 2 of the 6 preceding calendar years. A narrow exception extends this where a foreign employer paid all of your compensation.

Claiming exempt status is not automatic. You have to file Form 8843 for each year you claim it, even if you owe no tax and file no other return. A student in year six who never noticed the clock running out is the single most common version of this problem.

If you meet the test anyway: two ways out

The Closer Connection exception

You can meet the test and still be treated as a nonresident, if all of the following hold:

  • You were present in the US for fewer than 183 days in the current year alone. Not weighted — actual days, this year. If you were there 183 days or more this year, this door is closed.
  • You had a tax home in a foreign country for the year.
  • You had a closer connection to that country than to the United States.

A tax home means a residence available to you continuously, not just for short stays. Whether you own or rent it, and whether it is a house or a furnished room, does not matter.

For the closer connection itself, the IRS weighs where your permanent home, family and belongings are; the country on your official documents; your social, political, cultural and religious ties; where you do business; which jurisdiction issued your driving licence; where you vote; and where you give to charity. No single factor decides it.

You claim it on Form 8840, filed by the return deadline. Miss the filing and you generally lose the exception, unless you can show clear and convincing evidence that you acted reasonably.

One hard disqualifier: you cannot claim the Closer Connection exception if, during the year, you applied for lawful permanent residence or had an adjustment of status application pending. Applying for a green card is treated as declaring where your connection lies.

A tax treaty tie-breaker

If you are a resident of both the US and a treaty country under each country's domestic rules, most treaties contain a tie-breaker: permanent home first, then centre of vital interests, then habitual abode, then citizenship. A treaty tie-breaker can override the Substantial Presence Test result even when you were present for 183 days or more, which is the situation the Closer Connection exception cannot help with.

Treaty positions have their own disclosure requirements and vary considerably between treaties. This is the point at which the question stops being arithmetic and starts being a matter for a cross-border tax professional.

When residency starts and stops

Meeting the test does not necessarily make you a resident for the whole calendar year. Your residency starting date is generally the first day you were present in the US during that year. Days when you were an exempt individual do not count, so if your exempt status ran out mid-year, your residency can start later than the day you arrived.

Residency generally ends on 31 December of the year you leave. It can end on your last day of presence instead, if for the rest of that year you have a tax home in a foreign country and a closer connection to it, and you are not a US resident the following year.

A year with a residency start or end date part-way through is a dual-status year, which has its own filing rules and restrictions.

What being a resident actually means

The reason any of this matters: a US tax resident is taxed on worldwide income, not just US-source income. Your salary abroad, your rental income, your investment gains in another country — all of it enters the US return. Foreign account and asset reporting obligations can attach as well, and those carry penalties that are not proportional to the tax involved.

None of this is about immigration status. You can be lawfully present on a temporary visa and simultaneously be a US tax resident. The two systems ask different questions and give different answers.

What to do

Count first, travel second. The weighted total is knowable in advance, and the difference between meeting the test and not meeting it is often a handful of days you would happily have spent elsewhere.

The US Substantial Presence Test Calculator does the weighting for you and shows each year's contribution on its own line, so you can see the shape of the problem rather than a single verdict. If the result is close either way, or if exempt status or a treaty is in play, that is the point to take it to someone who does this professionally.

This guide describes the published IRS rules as a general matter. It is not tax advice, it cannot account for your circumstances, and the rules change. Verify anything that affects a filing against the IRS source material or with a qualified cross-border tax adviser.

Sources

Every rule described above comes from one of these. Where a figure or a threshold matters to a decision, check it here rather than relying on this page — the rules change, and this page may not have caught up.

  1. IRS — Substantial Presence Test — the 31-day and weighted 183-day conditions, and the full list of days that do not count
  2. IRS — Exempt Individual: Who Is a Student — the 5-calendar-year limit and the Form 8843 requirement
  3. IRS Publication 519, US Tax Guide for Aliens — the 2-of-6-years rule for teachers and trainees, and the foreign-employer exception
  4. IRS — Conditions for a Closer Connection to a Foreign Country — the under-183-day threshold, the factors weighed, Form 8840 and the green-card disqualifier
  5. IRS — Residency Starting and Ending Dates — how the start date is set and when residency ends

Frequently asked questions

Is the Substantial Presence Test just a 183-day rule?

No. 183 is the threshold, but the days are weighted. Days in the current year count in full, days in the year before count as one third each, and days in the year before that count as one sixth each. You can be well under 183 actual days in the current year and still meet the test on the weighted total.

Do partial days in the US count?

Yes. You are treated as present on any day you are physically in the United States at any time during that day, so arrival and departure days both count in full. The main exception is being in transit between two foreign places for less than 24 hours without leaving the transit area.

Does a student visa stop the clock?

For a limited number of years. Students on F, J, M or Q visas are exempt individuals and their days do not count at all, but only for up to 5 calendar years. Teachers and trainees on J or Q visas are exempt if they were not exempt for any part of 2 of the 6 preceding calendar years. Exempt individuals still have to file Form 8843 for each year they claim it.

What is the Closer Connection exception?

If you meet the test but were present for fewer than 183 days in the current year alone, had a tax home in a foreign country for the whole year, and had a closer connection to that country than to the United States, you can be treated as a nonresident. You claim it on Form 8840. You cannot use it if you applied for a green card or have an adjustment of status application pending.

What happens if I meet the test?

You are treated as a US resident for income tax purposes, which means the US taxes your worldwide income, not just your US-source income, and foreign account reporting obligations can apply. This is separate from your immigration status — you can be a tax resident while holding a temporary visa.

When does my residency actually start?

Generally the first day you were present in the United States during the year you meet the test. Days when you were an exempt individual are not counted, so the start date can be later than the day you physically arrived.