All 6 rules for the US

Substantial presence test: how US tax residency days are counted

You meet the substantial presence test — and are treated as a US resident for tax purposes — if you’re in the US for at least 31 days this year and 183 days over three years, counting all of this year’s days, a third of last year’s and a sixth of the year before’s.

Substantial presence test calculator

Count every day you were in the US for any part of it, leaving out the days that don’t count (below). Exempt individuals, such as students on an F or J visa, leave out those years’ days.

How the test works

You meet the substantial presence test for a calendar year if you were physically present in the US on at least:

  1. 31 days during the current year, and
  2. 183 days during the 3-year period made of the current year and the two years before, counting:
    • all the days you were present in the current year,
    • a third of the days in the first year before, and
    • a sixth of the days in the second year before.

Example: 120 days in the US in each of three years.

Year Days that count In the example
Current year all of them — and at least 31 120
First year before a third 40
Second year before a sixth 20
Total 183 or more meets the test 180 — under 183, so the test isn’t met

How many days a year keep you under the test

Spend the same number of days in the US every year, and 121 days a year keeps you under: 121 + a third of 121 + a sixth of 121 is 181.5. At 122 days a year the total reaches 183 and you meet the test. When the years differ, the calculator above weighs each one for you — and fewer than 31 days in the current year never meets the test, whatever the years before.

Which days count

You’re treated as present on any day you’re in the US at any time during the day. These days don’t count:

  • days you commute to work in the US from a home in Canada or Mexico;
  • days you’re in the US in transit for less than 24 hours between two foreign places;
  • days as a crew member of a foreign vessel;
  • days you couldn’t leave because of a medical condition that arose while you were in the US;
  • days you’re an exempt individual.

Exempt individuals

Days in these statuses don’t count toward the test:

  • foreign government-related individuals (A or G visas, other than A-3 and G-5);
  • teachers or trainees on a J or Q visa;
  • students on an F, J, M or Q visa;
  • professional athletes competing in a charitable sports event.

To exclude these days — or days kept by a medical condition — you file Form 8843 with your tax return.

The exemption runs out:

  • Students stop being exempt once they’ve been exempt as a teacher, trainee or student for any part of more than 5 calendar years — unless they show they don’t intend to live in the US permanently and have kept to their visa’s requirements.
  • Teachers and trainees aren’t exempt if they were exempt as a teacher, trainee or student for any part of 2 of the 6 preceding calendar years — with an exception when a foreign employer paid them.

The closer connection exception

Even if you meet the test, you can be treated as a nonresident for the year if all of these hold:

  • you were in the US for fewer than 183 days during the year;
  • you kept a tax home in a foreign country for the entire year;
  • you had a closer connection to that country than to the US;
  • you haven’t taken steps toward a green card or had an application pending.

You claim it on Form 8840. If you don’t file it on time, you can’t claim the exception unless you can show you took reasonable steps to learn about the filing requirement.

When to file Forms 8840 and 8843

If you file Form 1040-NR, attach them to it. If you don’t have to file a return, mail them to the IRS in Austin by the due date for Form 1040-NR: April 15 if you had US wages subject to withholding, June 15 if you didn’t — April 15 or June 15, 2026, for 2025. Miss it, and you can’t claim the closer connection exception or exclude the days, unless you can show you took reasonable steps to learn about the requirement and meet it.

Meet the test: from when are you a US resident?

Not from January 1. Your residency starting date is the first day you were in the US in the year you meet the test, and you’re a nonresident for the part of the year before it — a dual-status year. Up to 10 days of an earlier visit can be left out of the starting date, with a signed statement to the IRS, if on those days your tax home was abroad and you had a closer connection there; they still count toward the 183.

Leaving works the same way. If you won’t be a US resident at any time next year, your residency ends on December 31 — or on the last day you were in the US, if for the rest of the year your tax home was abroad and you had a closer connection to that country.

Resident in the US and another country? The treaty tie-breaker

The test doesn’t override a tax treaty. If you’re resident in both the US and a treaty country under each country’s own rules, the treaty’s tie-breaker rule settles it. Treated as a resident of the other country, you figure your US tax as a nonresident — on Form 1040-NR with Form 8833 attached — though for other purposes you’re still a US resident.

How FlySee counts it

FlySee doesn’t have a tracker for the substantial presence test. Its Log records the days you’re in the US the same way the test counts them — any part of a day is a day — and its export lists your days by country, so you can weigh each year yourself. The calculator above is the IRS formula: it weighs the days you type in, nothing more.

Substantial presence test: questions and answers.

Does a day I fly in or out count?

Yes. You’re treated as present in the US on any day you’re physically present at any time during the day — unless the day is one of those that don’t count, such as a transit of less than 24 hours between two foreign places.

Do F-1 and J-1 students count their days?

Students on F, J, M or Q visas are exempt individuals: their days in that status don’t count toward the test — for up to 5 calendar years as a teacher, trainee or student, unless they show they don’t intend to live in the US permanently. To exclude the days, they file Form 8843.

Can I meet the test and still be treated as a nonresident?

Yes, through the closer connection exception — if you were in the US for fewer than 183 days in the year, kept a tax home in a foreign country all year, had a closer connection to it than to the US, haven’t applied for a green card, and file Form 8840 on time.

What is Form 8843?

The statement exempt individuals — and people excluding days for a medical condition — file to exclude those days. Without it, the days can’t be excluded.

How many days can I spend in the US each year without meeting the test?

With the same number of days every year, 121: that’s 121 + 40.33 + 20.17 = 181.5, under 183. At 122 days a year the total reaches 183. Fewer than 31 days in the current year never meets it.

If I meet the test, am I a US resident for the whole year?

No. Your residency starts on the first day you were in the US that year — up to 10 days of an earlier visit can be left out — and you’re a nonresident for the part of the year before it: a dual-status year.

Sources

FlySee counts days; it doesn’t give tax advice. Whether you’re resident is for you and your adviser.

Track it in FlySee

Track days in every country and know the date you can stay until.

  • Logs the days you’re in the US, automatically — any part of a day is a day
  • Rebuilds past years from your photos, so earlier years’ days are on record
  • Exports your days by country as PDF, Excel or CSV for your tax preparer
Download on the App Store
  • Free to download
  • free trial
  • no account

Get FlySee on your iPhone

Point your iPhone’s camera at the code to open FlySee on the App Store.

Free to download · free trial · no account

Open the App Store page