Substantial Presence Test: How to Count Your 183 Days
The IRS substantial presence test decides whether someone who is not a US citizen or green card holder counts as a US resident for federal income tax. You meet it for a calendar year if you were in the US on at least 31 days that year and on at least 183 days over three years, counting all of this year’s days, one third of last year’s and one sixth of the year before. This guide explains how to count the days correctly, works through 2027 examples day by day, and gives a table of the most days you can spend in the US in 2027 without meeting the test. It is general information, not tax advice.
At a glance (as of November 2026)
- For 2027: days in 2027 + 1/3 of days in 2026 + 1/6 of days in 2025. You meet the test if that total is 183 or more and the 2027 count is at least 31.
- Any part of a day counts as a day. Arriving at 11 p.m. is one day.
- If you spend the same number of days in the US every year, 121 a year stays under the line (181.5) and 122 meets it (exactly 183).
- Some days do not count: regular commuting from Canada or Mexico, transit of under 24 hours, foreign-vessel crew days, a medical condition that stops you leaving, and days as an “exempt individual” (certain students, teachers and trainees).
- Meeting the test does not always make you a resident: the closer connection exception (Form 8840) can apply if you were in the US on fewer than 183 days in the current year.
The formula, exactly as the IRS states it
The IRS substantial presence test page (last reviewed March 14, 2026) sets two conditions. You must be physically present in the US on:
- at least 31 days during the current year, and
- 183 days during the three-year period made up of the current year and the two years before it, counting all the days in the current year, 1/3 of the days in the first year before, and 1/6 of the days in the second year before.
The IRS’s own example: 120 days in each of 2023, 2024 and 2025 gives 120 + 40 + 20 = 180 for 2025, so that person does not meet the test. Both conditions must be met. Someone with 30 days in the current year never meets the test for that year, however many days they spent in the two years before.
Two details trip people up:
- The weights apply to whole calendar years, January 1 to December 31. It is not a rolling 365-day window like the Schengen 90/180 rule.
- Do not round the fractions down. One third of 124 days is 41.33, not 41. The IRS page gives no rounding rule (its example divides evenly), so all our calculations below use exact fractions, which is the cautious choice. Rounding down can make you think you are under 183 when you are not.
How to count a “day”
IRS Publication 519 says you are treated as present on any day you are physically present in the country at any time during the day. So the day you arrive and the day you leave each count in full. A trip that lands on Friday night and leaves on Sunday morning is three days, not two. Our days between dates calculator can count a stay with both end dates included; tick “Include the end date”, because a plain subtraction (end minus start) gives one day fewer.
Days that do not count
According to the IRS page, you do not count:
- days you commute to work in the US from a home in Canada or Mexico, if you regularly commute;
- days you are in the US for less than 24 hours while in transit between two places outside the US;
- days you are in the US as a crew member of a foreign vessel;
- days you cannot leave because of a medical condition that developed while you were in the US;
- days you are an exempt individual.
Exempt individuals include students temporarily in the US on an F, J, M or Q visa (IRS: who is a student) and teachers or trainees on a J or Q visa (IRS: teachers and trainees). The exemption has time limits. A student generally stops being exempt after being exempt as a teacher, trainee or student for any part of more than 5 calendar years, unless they show the IRS that they do not intend to live permanently in the US and have substantially complied with the terms of their visa. A teacher or trainee is generally not exempt if they were exempt as a teacher, trainee or student for any part of 2 of the 6 preceding calendar years (3 of the 6 if a foreign employer paid all of their compensation). Note “any part of”: a few days in a year use up that whole year. To exclude these days you must file Form 8843; the IRS pages explain when to attach it to a return and when to mail it on its own.
The most days you can spend in the US in 2027
This table answers a common planning question. Find your 2026 days on the left and your 2025 days across the top. The number is the most days you can be in the US in 2027 without meeting the test.
| Days in 2026 ↓ / Days in 2025 → | 0 | 60 | 120 | 182 |
|---|---|---|---|---|
| 0 | 182 | 172 | 162 | 152 |
| 60 | 162 | 152 | 142 | 132 |
| 90 | 152 | 142 | 132 | 122 |
| 120 | 142 | 132 | 122 | 112 |
| 150 | 132 | 122 | 112 | 102 |
| 182 | 122 | 112 | 102 | 91 |
The rule behind it: the most 2027 days is the largest whole number below 183 − (2026 days ÷ 3) − (2025 days ÷ 6). For your own numbers, work that out and subtract one if the result is already a whole number. We built the table two ways (a day-by-day search and this formula) and they agree for every combination from 0 to 365 days.
The 121-day rule of thumb
If you spend the same number of days in the US every year, your total is that number × (1 + 1/3 + 1/6) = 1.5 × the number. So 121 days a year gives 181.5 and stays under, while 122 days a year gives exactly 183 and meets the test. In other words, a steady pattern of about four months a year is the most that stays under, which is why the IRS’s 120-day example lands just below the line.
Worked examples for 2027
Example 1: a winter visitor
Someone spends January 5 to April 20 in the US each year, in 2025, 2026 and 2027. Counting both end dates, that is 106 days each year.
- 2027: 106 days
- 2026: 106 ÷ 3 = 35.33
- 2025: 106 ÷ 6 = 17.67
- Total for 2027: 159, under 183. The test is not met.
From the table logic, this person could spend up to 129 days in the US in 2027, so a fall trip of up to 23 more days would still keep them under. A 24-day trip would bring the total to exactly 183 and meet the test. If they did go over, the closer connection exception (below) may still let them be treated as a nonresident, because they would still be under 183 days in 2027 itself.
Example 2: a work assignment that runs into a second year
Someone arrives on Monday, August 17, 2026 for a project and leaves on Friday, December 18, 2026. They had no US days in 2025, and they are not an exempt individual.
- 2026: 124 days. For 2026 the total is 124, so the test is not met in 2026.
- For 2027, the 2026 days count as 124 ÷ 3 = 41.33. They meet the test on their 142nd day in the US in 2027, because 142 + 41.33 = 183.33.
- If they return on Monday, January 4, 2027 and stay continuously, day 142 is Tuesday, May 25, 2027. They can be in the US on up to 141 days in 2027 without meeting the test.
If they do meet it, Publication 519 says the residency starting date is generally the first day they are present in the US during that calendar year (here January 4, 2027), not the day they hit 183. Up to 10 days of presence can be ignored in setting that date if, on those days, they had a closer connection to a foreign country and a tax home there.
The closer connection exception (Form 8840)
Meeting the test is not always the end of the story. Under Publication 519, you can still be treated as a nonresident alien if, for the year, you:
- were present in the US on fewer than 183 days during that year,
- kept a tax home in a foreign country during the year, and
- had a closer connection to that country than to the US.
You cannot claim it if you applied for, or took other steps toward, permanent resident status, or had an adjustment-of-status application pending during the year. You claim it on Form 8840, filed by the due date for Form 1040-NR. Publication 519 says that if you file late you generally cannot claim the exception, unless you show by clear and convincing evidence that you took reasonable actions and significant steps to comply. Tax treaties can also affect residency for people who are residents of both countries; Publication 519 covers the tie-breaker rules.
The exception only works while you are under 183 days in the current year. In Example 1 above, the visitor could use it; someone who spends 183 days or more in the US in 2027 cannot.
Common mistakes
- Counting nights instead of days. Any part of a day counts. Arrival and departure days are both included.
- Using the wrong years. For 2027, the earlier years are 2026 and 2025, weighted 1/3 and 1/6. Days in 2024 do not count at all.
- Rounding down the fractions (see above).
- Treating the test as a visa limit. It is a tax test only. How long US immigration lets you stay, and any rules in your home country (for example, residency rules for health coverage), have their own counts and do not change this one.
- Forgetting Form 8843 or 8840. Excluding exempt days needs Form 8843; the closer connection exception needs Form 8840 on time.
- Relying on memory. Keep passport stamps, boarding passes or travel records. Our date calculator helps with “how many days from this date” checks when you plan a return trip.
Frequently asked questions
Is the 183-day rule a rolling 12 months?
No. The IRS test uses calendar years: all days in the current year, 1/3 of last year’s and 1/6 of the year before.
Does a partial day count?
Yes. Being in the US at any time during a day counts as a day, except in the listed cases such as transit of under 24 hours between two places outside the US.
How many days can I spend in the US every year without becoming a tax resident?
If the number is the same every year, 121 days keeps the three-year total at 181.5, under 183. At 122 days a year the total is exactly 183 and the test is met. Exceptions such as the closer connection exception may still apply.
Do days on a student visa count?
Days as an exempt student (F, J, M or Q visa) are not counted, within the time limits above, and you must file Form 8843 to exclude them.
Can I meet the test and still be a nonresident?
Possibly, through the closer connection exception (fewer than 183 days in the current year, a foreign tax home and a closer connection abroad, claimed on Form 8840) or a tax treaty. Check with the IRS or a qualified tax adviser.
Sources and method
- Test conditions, weights and excluded days: IRS, Substantial Presence Test (last reviewed March 14, 2026).
- Any-part-of-a-day rule, closer connection exception, Form 8840 deadline, residency starting date and the 10-day rule: IRS Publication 519 (2025), U.S. Tax Guide for Aliens.
- Exempt individuals: IRS, students; IRS, teachers and trainees.
- All day counts and the 2027 table: our own calculation (Python, exact fractions), checked with a second, independent method. The rules can change; check the IRS pages above for the year you are filing.
This guide is general information, not tax or legal advice. Last checked: November 8, 2026.