How the substantial presence test works with examples
Count 31 days this year and 183 weighted days over three years. Six worked cases for H-1B workers, students, frequent visitors and late arrivals.

This is for noncitizens who are not green card holders and need to know whether they are resident aliens for tax purposes this year: H-1B and L-1 workers, business visitors, students near the end of their exempt years, and anyone who splits time between the US and another country. It counts the days with real dates in six cases. It is not for green card holders, who are residents under a separate test, and it does not cover state residency.
The test itself is two lines of arithmetic. Most mistakes come from counting the wrong days, not from the formula.
The test
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 the current year, and
183 days during the three-year period of the current year and the two years before it, counting all the days in the current year, one third of the days in the year before, and one sixth of the days in the year before that (IRS, Substantial presence test).
Any part of a day counts as a full day. Landing at 11 p.m. on March 3 makes March 3 a day of presence.
Days you do not count
Publication 519 lists the days left out of the count (IRS, Publication 519):
days you regularly commute to work in the US from a home in Canada or Mexico, meaning more than 75 percent of your workdays
days in transit for less than 24 hours between two places outside the US
days as a regular crew member of a foreign vessel
days you could not leave because of a medical condition that arose while you were here, claimed on Form 8843
days as an exempt individual: F, J, M or Q students, generally for their first five calendar years; J or Q teachers and trainees, unless they were exempt as a teacher, trainee or student for any part of two of the previous six years; and certain foreign government-related individuals
Exempt individuals claim those days by filing Form 8843, even with no income.
Six cases
1. H-1B worker who arrives in the spring
Lin is admitted in H-1B status on March 16, 2026, and stays in the US for the rest of the year. She was never here before.
Days in 2026: March 16 to December 31 is 291 days.
291 is at least 31 and at least 183. She meets the test for 2026.
Her residency starting date is March 16, 2026, so 2026 is a dual-status year.
2. H-1B worker who arrives in the fall
Omar is admitted on October 1, 2026.
Days in 2026: October 1 to December 31 is 92. Days in 2025 and 2024: none.
92 is under 183. He does not meet the test for 2026 and is a nonresident alien for the whole year.
In 2027, if he stays all year, he meets the test from January 1. He may be able to choose to be treated as a resident for part of 2026 under the first-year choice, explained in its own post.
3. A frequent business visitor
Grace, a sales engineer on B-1 trips, was present 120 days in 2024, 120 days in 2025 and 120 days in 2026.
120 (2026) + 120 / 3 (2025, which is 40) + 120 / 6 (2024, which is 20) = 180.
180 is under 183. She does not meet the test for 2026.
Had she been present 122 days each year: 122 + 40.67 + 20.33 = 183. She would meet it. Frequent visitors keep a travel log for exactly this reason.
4. A visitor who meets the test but has a closer connection abroad
Hans spent 150 days in the US in each of 2024, 2025 and 2026, keeping his home, family and job in Germany.
150 + 50 + 25 = 225. He meets the test.
But he was present fewer than 183 days in 2026 itself, his tax home is in Germany and he has a closer connection to Germany. He can claim the closer connection exception on Form 8840, filed by the due date, and be treated as a nonresident alien.
The exception is not available if you personally applied, or took other steps during the year, to become a permanent resident, or had an application to adjust status pending during the year (Publication 519). For an H-1B worker whose green card process moved forward that year, it is usually closed.
5. An F-1 student in the sixth year
Mei arrived on F-1 on August 15, 2021, and has been in the US every year since.
2021 through 2025 are her five exempt calendar years. Those days are not counted.
In 2026, her days count. She is present from January 1. By July 2, 2026, she has 183 days in 2026, so she meets the test, and her residency starting date is January 1, 2026, her first day of presence that year.
Earlier years' days do not help her reach 183 because they were exempt; her 2026 days alone get her there.
6. Someone who leaves partway through the year
Carlos was a resident alien in 2025 and leaves the US for good on May 31, 2026, moving his home and job to Mexico.
Days in 2026: January 1 to May 31 is 151. 2025 and 2024 add 365 / 3 and 365 / 6, so the total easily passes 183. He meets the test for 2026.
His residency can end on May 31, 2026, rather than December 31, if his tax home was in Mexico and he had a closer connection there for the rest of the year, with a statement filed with his return.
Where people go wrong
Counting only the days on the visa. The test counts physical presence, under any status. A week as a tourist in February counts toward an H-1B worker's total.
Forgetting the weighting. One third and one sixth apply to the earlier years, not the current one. Current-year days count in full.
Assuming a student is never a resident. The exemption lasts five calendar years for most students, counting partial years. A student who arrived in December used up a year.
Skipping Form 8843. Exempt individuals are required to file it. For days excluded because of a medical condition, Publication 519 is explicit: miss the deadline and you cannot exclude those days, unless you can show you took reasonable steps to comply.
A note on records
Keep your I-94 travel history from CBP, boarding passes and passport stamps. The IRS can ask how you counted, and your own log is the only proof of a 182-day year.


