The U.S. Substantial Presence Test
If you aren’t a U.S. citizen or green card holder, the IRS decides whether you’re a U.S. tax resident by counting your days in the country over three years. The math is simple once you have the dates, but some days are left out of the count, so the exact dates matter.
Updated
On this page
Past the Hedge can keep this record for you. Sign up free →
The test: 31 days, then 183
For a calendar year, you meet the Substantial Presence Test if you were in the United States on at least:
- 31 days during the current year, and
- 183 days over the three-year period that includes the current year and the two years before it, counting:
- every day in the current year,
- one-third of the days in the year before, and
- one-sixth of the days in the year before that.
Fractions aren’t rounded. And with 30 days or fewer in the current year, you don’t meet the test, however big the weighted total is.
Your next step: if you’re close to 183 in the weighted count, list every U.S. day for all three years before you file, and check whether you can claim the closer connection exception on Form 8840 by your return’s due date.
Source IRS: Substantial presence test, and 26 CFR 301.7701(b)-1.
What counts as a day
You’re treated as present on any day you’re physically in the United States at any time during the day. The day you arrive and the day you leave normally both count, unless an exclusion below applies.
For this test, the United States means the 50 states and the District of Columbia, plus U.S. territorial waters and certain offshore seabed areas. It doesn’t include U.S. territories or U.S. airspace.
Source IRS: Substantial presence test.
Days you don’t count
Some days are left out of the count:
- In transit: a stop of less than 24 hours while traveling between two places outside the United States. A business meeting during the stop, even in the airport, means the day counts.
- Commuting from Canada or Mexico: days you commute to work in the U.S. from home in Canada or Mexico, returning home within 24 hours, if you commute on more than 75% of your workdays in the working period.
- A medical condition: days you meant to leave but couldn’t because of a condition that arose while you were in the U.S. A condition you knew about before you came doesn’t qualify.
- Exempt individuals: days as a student on an F, J, M or Q visa, or a teacher or trainee on a J or Q visa, if you substantially comply with your visa; certain foreign government staff; and professional athletes on the days they compete in certain charity events.
Exempt status has limits. A student is usually exempt for no more than 5 calendar years in all, and any part of a year counts as a whole year. A teacher or trainee usually isn’t exempt if they were exempt as a teacher, trainee or student for any part of 2 of the 6 years before, with a limited exception for those paid by a foreign employer. Students, teachers, trainees and people excluding medical days file Form 8843 each year to claim those days, even when they don’t have to file a tax return.
Source 26 CFR 301.7701(b)-3, IRS: Exempt individual who is a student, teachers and trainees, About Form 8843, and Publication 519.
Meeting the test isn’t always the end
If you meet the test but were in the U.S. on fewer than 183 days in the current year itself, you may still be treated as a nonresident under the closer connection exception. You also need to:
- Have your tax home in another country for the whole year, usually where you mainly work. A move between two foreign countries can qualify under extra conditions.
- Have a closer connection to that country than to the U.S., shown by things like where your home, family, belongings, bank accounts and driver’s license are.
- Not have applied for, or taken steps toward, a green card.
- File Form 8840 by the due date of your tax return, including extensions.
With 183 days or more in the current year, this exception isn’t available, though a tax treaty with your home country may still help.
Source IRS: Closer connection exception to the substantial presence test.
When residence starts and ends
In your first year as a resident under this test, residence usually starts on the first day you were in the U.S. that year, not the day you crossed 183. In your last year, it usually runs to December 31. It can end on your last day in the U.S. if you keep a tax home and closer connection abroad for the rest of the year, aren’t a resident the next year, and file a statement with the IRS. A year with both is a dual-status year, with different rules for each part.
Source IRS: Residency starting and ending dates.
Find your U.S. days
CBP’s I-94 website shows your most recent arrival record and a travel history of your arrivals and departures; the IRS points to it in the Form 8843 instructions. Compare it with your own records and resolve any gaps: land departures, in particular, aren’t always captured.
You need three calendar years of dates, counted day by day, with both travel days included. That’s where your bookings help.
Rebuild three years of trips
Past the Hedge builds a trip from each confirmation you forward, including ones from years ago. Forward your old flight, hotel, rail and cruise emails, and your trips line up in date order, each with the dates you left and came back and the countries it went to: most of what the count asks for.

- Forward the original confirmations to your private address. We receive only what you forward, and never connect to your inbox.
- Missing an email? Add the trip by hand from a stamp, a receipt or a government record.
- If the form asks why you traveled, add the reason yourself: a booking email may not say.
Start your travel history freeWhat to forward and what gets read → · Adding past trips →
Check before you file
- Count by calendar year, January 1 to December 31.
- Count the day you arrive and the day you leave, unless an exclusion applies.
- Keep a note of the reason for any day you leave out, and file Form 8843 or 8840 on time where it applies.
Important This page explains what the official guidance says. It isn’t tax advice. Residence affects how all your income is taxed. If you’re near 183, have income in more than one country, or might use a tax treaty, talk to a tax professional who works with nonresidents.
Count your days from real records
Forward your flight and hotel emails and each trip is saved with the dates you left and came back, so the days you count start from bookings, not memory.
Premium, free during the beta, turns it into a trip list you can download for your form.
Sign up freeSee a sample account first
Free to sign up. No card needed.
