United States · Tax residency
Substantial presence test calculator.
Enter the days you were present in the U.S. this year and the two before. The tool applies the IRS 1, 1/3 and 1/6 weighting and the 31-day floor.
You meet the test if you were here 31 or more days this year and the weighted total reaches 183: every day this year, one-third of last year's days and one-sixth of the year before. IRS example: 120 days in each of three years is 180, which is not enough.
The rule, variable by variable
The IRS treats an alien as a U.S. resident for tax purposes if they meet either the green card test or the substantial presence test for a calendar year. For the substantial presence test you need both parts: presence on at least 31 days during the current year, and 183 days over a three-year window counted this way:
- every day present in the current year, times 1;
- days present in the first year before, times 1/3;
- days present in the second year before, times 1/6.
You are treated as present on any day you are physically in the United States at any time during the day, so a short evening stopover counts unless an exception applies. This tool keeps exact fractions and compares whole sixths, so a result like 182.83 is never rounded up to 183.
Days that do not count
Publication 519 says not to count: days you commute to work in the U.S. from a residence in Canada or Mexico if you regularly commute; days under 24 hours spent in transit between two places outside the U.S.; 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; days under a NATO visa as a member of a force or civilian component; and days as an exempt individual. Exempt individuals include certain foreign government-related individuals, teachers and trainees, students, and professional athletes at a qualifying charitable sports event. Students on F, J, M or Q visas are generally not exempt after more than five calendar years of exempt student, teacher or trainee status, unless they show they do not intend to reside permanently and substantially complied with their visa. Enter only the days left after these exclusions.
Worked examples
The IRS example. 120 days in each of 2025, 2024 and 2023 gives 120 + 40 + 20 = 180. Under 183, so not a resident under this test for 2025.
Hypothetical, passes the weighted test. 150 days in 2025, 180 in 2024, 90 in 2023 gives 150 + 60 + 15 = 225, so the test is met. Because the person was here fewer than 183 days in 2025, a closer connection claim is worth examining (see below).
Hypothetical, fails the 31-day floor. 30 days in 2025 with 365 in each earlier year gives 30 + 121.67 + 60.83 = 212.5 weighted days, but 30 is below 31, so the test is not met.
The closer connection exception and Form 8840
Even if you meet the test, you may be treated as a nonresident if you were here fewer than 183 days during the year, kept a tax home in a foreign country, and had a closer connection to that country than to the United States. You claim it by attaching a completed Form 8840 to your tax return by the Form 1040-NR due date. If you do not file on time you cannot claim it. Exempt individuals and people claiming the medical-condition exclusion file Form 8843 instead.
Common mistakes
- Counting days of exempt status or Canada and Mexico commuting.
- Forgetting the 31-day floor when prior years are heavy.
- Using a fiscal year. The test runs on the calendar year.
- Assuming the test applies to green card holders. They are residents under a separate test.
- Treating the result as a visa or immigration-status answer. It is a tax test.
What this does not cover
It does not run the green card test, treaty tie-breaker rules, dual-status years, the first-year choice, or any state residency test, and it does not decide whether your closer connection claim is strong. It is built for individuals with simple day counts and is not tax advice.
Sources
- IRS: Substantial presence test — 31 days, 183 weighted days, excluded days, example (page reviewed March 14, 2026).
- IRS: Publication 519, U.S. Tax Guide for Aliens (2025) — Days of presence, exempt individuals, closer connection, Form 8840 and 8843.
- IRS: About Form 8840 — Closer connection exception statement (page reviewed March 30, 2026).
Retrieved October 2026. Publication 519 is revised each year for that year's returns.
Frequently asked questions
How many days in the U.S. make you a tax resident?
Under the substantial presence test you need at least 31 days in the current year and a weighted total of 183 days over three years. The weights are all current-year days, one-third of last year's and one-sixth of the year before's.
How is the 183-day rule calculated?
Add the current year's days, one-third of the prior year's days and one-sixth of the days from two years before. For 120 days in each of three years, that is 120 plus 40 plus 20, or 180, which falls short of 183.
Do days in transit count toward the substantial presence test?
Not if you were in the United States for less than 24 hours while in transit between two places outside the country. Activities unrelated to completing the trip, such as a business meeting, can make the day count.
Do F-1 student days count?
Usually not for the first five calendar years. Days as an exempt individual are excluded, and F, J, M and Q students are generally exempt for up to five calendar years. After that they count unless the student shows they do not intend to reside permanently and substantially complied with the visa.
What is the closer connection exception?
It lets someone who meets the test be treated as a nonresident if they were present fewer than 183 days in the year, kept a tax home in a foreign country, and had a closer connection to that country. It is claimed with Form 8840.
Does the substantial presence test apply to green card holders?
Green card holders are residents under a separate green card test. The IRS treats you as a resident alien if you meet either the green card test or the substantial presence test for the year.
Does the test use the calendar year?
Yes. Publication 519 frames the test for the calendar year, January 1 through December 31.
Does a partial day count as a day?
Yes, with exceptions. You are treated as present on any day you are physically in the United States at any time during the day, unless an exception such as short transit, commuting or exempt status applies.
Not legal or tax advice
This page applies the IRS day-count formula to numbers you enter. It is not tax advice, does not determine your immigration status, and does not decide any treaty or closer connection claim. Confirm with Publication 519 or a tax professional before filing.