Substantial presence test calculator: how the IRS counts your days
If you are not a US citizen or green card holder, the US treats you as a resident alien for tax purposes when you meet the substantial presence test. A resident is taxed on worldwide income like a citizen; a nonresident only on US-source income. The test is purely about counting days, which makes it easy to get wrong when trips are spread over three years.
This calculator applies the rule from IRS Publication 519: at least 31 days in the current year, and 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. Type day totals or paste your trip dates, mark the days that do not count, choose an F, J, M or Q visa status to apply the exempt-individual rules, and see whether you meet the test and how many days you have left this year.
How to use the Substantial Presence Test Calculator
- Enter the tax year you want to test.
- Type the days you were in the US in that year and the two years before, or switch to Trip dates and paste each stay as “arrival to departure”.
- If you hold an F, J, M or Q visa (or an A or G visa), choose the status and the first calendar year you were in the US with it.
- Open Days not counted for commuting, transit, crew or medical days.
- Read the weighted total, the 31- and 183-day verdict, the days you have left and the closer connection checklist.
Substantial Presence Test Calculator features
Exact weighting
Counts in sixths, so 120 + 40 + 20 is exactly 180, with no rounding at the edge.
Trip dates
Counts arrival and departure days, merges overlapping stays and splits them by calendar year, leap days included.
Exempt years
Students: the first five calendar years. Teachers and trainees: not exempt after any part of 2 of the 6 preceding years, or 3 of 6 if a foreign employer paid them.
Days left
How many more days you can spend in the US this year before meeting the test.
Closer connection check
Shows when the Form 8840 exception may apply and when it cannot.
The 31-day and 183-day rules
You meet the test for a year if you were physically present in the United States on at least 31 days that year and the weighted three-year total reaches 183. Any part of a day counts as a day. The IRS’s own example: 120 days in each of three years gives 120 + 40 + 20 = 180, so the test is not met; three more days in the current year would meet it.
| Year | Days counted | Weight |
|---|---|---|
| Current year | All counted days (at least 31) | × 1 |
| Year before | All counted days | × 1/3 |
| Two years before | All counted days | × 1/6 |
Days that do not count, and exempt individuals
Publication 519 excludes days you regularly commute to work from Canada or Mexico, days in transit for less than 24 hours between two foreign places, days as a crew member of a foreign vessel, days you could not leave because of a medical condition that arose while you were in the US, and days as an exempt individual. “Exempt” here means exempt from counting days, not from tax.
Students on F, J, M or Q visas are exempt individuals for any part of five calendar years; after that their days count unless they show they do not intend to live permanently in the US and have complied with their visa. Teachers and trainees on J or Q visas are not exempt if they were exempt as a teacher, trainee or student for any part of 2 of the 6 preceding calendar years (3 or fewer if a foreign employer paid all their compensation). Calendar years count, so arriving in December uses up a whole year. To exclude these days you generally file Form 8843 with the IRS, by the due date of Form 1040-NR.
Closer connection, treaties and limits
Even if you meet the test, you can be treated as a nonresident under the closer connection exception if you were present fewer than 183 days in the year, kept a tax home in a foreign country for the whole year and had a closer connection to that country. You claim it on Form 8840, and you cannot use it if you applied for or took steps towards a green card. A tax treaty’s tie-breaker rule may also help.
This tool does not handle the green card test, dual-status years, the first-year choice or treaty positions, and it assumes you kept your visa status on every day you were present. Rules as in IRS Publication 519 (2025) and irs.gov, checked 24 October 2026. It is a calculator, not tax advice. For other day counts, try the Schengen calculator or the date difference calculator.
Substantial Presence Test Calculator FAQ
How do I calculate the substantial presence test?
Add all your US days this year, one-third of last year’s and one-sixth of the year before’s. If the total is 183 or more and you were present at least 31 days this year, you meet the test.
Do F-1 students count days for the substantial presence test?
Not during their first five calendar years as an exempt individual, provided they comply with the visa. From the sixth calendar year their days count. They usually file Form 8843.
Do arrival and departure days count?
Yes. Any part of a day in the US counts, except the listed exceptions such as transit of less than 24 hours between two foreign places.
What is the 183-day rule in the US?
It is shorthand for the substantial presence test: 183 weighted days over three years, with at least 31 days in the current year.
Can I be a nonresident even if I meet the test?
Possibly, through the closer connection exception (fewer than 183 days this year, foreign tax home, Form 8840) or a tax treaty tie-breaker.
Is this tax advice?
No. It applies the published counting rules. Ask a qualified tax adviser about your own position.