Substantial Presence Test Calculator (US 183-Day Test)
Estimate, not legal or tax advice
Enter your days in the United States, or your trips, for the year you are testing and the two years before it. The calculator applies the IRS formula with exact fractions. Tick any Publication 519 categories that apply to you to leave those days out.
Information only, not tax, immigration or legal advice. Check with the IRS, the CRA and your province, or a qualified adviser, before you rely on a count.
How the test is counted
The IRS test has two numbers. You meet it for a calendar year if you were in the United States on at least 31 days in that year, and on at least 183 days in the 3-year period of that year and the 2 years before it, counting all the days of the current year, 1/3 of the days of the first year before and 1/6 of the days of the second year before.
Any part of a day counts: the IRS treats you as present on any day you are physically in the country, at any time during the day. This calculator counts days in the 50 states and the District of Columbia. The IRS definition of the United States also includes the territorial waters and certain adjacent seabed and subsoil, and leaves out US territories and US airspace.
The fractions are not rounded. 100 days in the year before add 33 1/3 days, and a weighted total of 182 5/6 is under 183.
Some days are not counted, but only for people they apply to: exempt individuals (some visa holders, such as F-1 students), regular commuters from Canada or Mexico, transit of less than 24 hours, crew of foreign vessels, a medical condition that kept you in the US, and NATO visa holders. The IRS needs Form 8843 for some of these.
Meeting the formula is not the whole answer. The closer connection exception (Form 8840) and tax treaties can still apply, and green card holders are tested differently. This page shows the count only.
The closer connection exception (Form 8840)
Even if the formula is met, the IRS may treat you as a nonresident under the closer connection exception. Excerpts from its conditions (the full list, and the rules for two foreign countries, are on the IRS page):
Were present in the United States less than 183 days during the year, and
Had a closer connection during the year to one foreign country in which you had a tax home than to the United States
Maintained a tax home in that foreign country during the entire year
Had not taken steps toward, and did not have an application pending for, lawful permanent resident status (green card).
IRS, closer connection exception page.
You must file Form 8840, Closer Connection Exception Statement for Aliens, to claim the Closer Connection Exception.
Read the closer connection exception (IRS) · Form 8840 (IRS). Fewer than 183 days in the year is one of the conditions, never the whole test. Tax treaties can also apply; see Publication 519.
Canadian? The snowbird day counter counts US days and days out of Canada from your trips.
Questions
How many days can I spend in the US before I meet the substantial presence test?
It depends on the two years before. With no days in those years, 183 days in the current year meet it. If you spend the same number of days in the US every year, 121 days a year give a weighted total of 181 1/2 and 122 days give exactly 183.
What is the 31-day rule?
You do not meet the test for a year in which you were in the US on fewer than 31 days, however large the weighted total is.
Do the days I arrive and leave count?
Yes. The IRS counts any day you are physically in the US, at any time during the day.
Do days on an F-1 student visa count?
Days as a student on an F, J, M or Q visa who substantially complies with the visa's requirements are days as an exempt individual and are not counted, within the limits in Publication 519 (generally not after being exempt as a teacher, trainee or student for any part of more than 5 calendar years). The IRS needs Form 8843 for these days. Tick the student box and enter those days.
Do Puerto Rico or other US territories count?
No. The IRS says the United States for this test does not include US territories or US airspace. This calculator counts days in the 50 states and the District of Columbia.
Is this how long I may stay as a visitor?
No. This is a tax day count. How long a visitor may stay is set by US immigration rules when you enter, which is a separate question.
Sources
- IRS: Substantial presence test. Page updated 14 March 2026. Last checked by us on 24 November 2026.
- IRS Publication 519 (2025), U.S. Tax Guide for Aliens. Last checked by us on 24 November 2026.
- IRS: Closer connection exception to the substantial presence test. Page updated 16 July 2026. Last checked by us on 24 November 2026.
- IRS: About Form 8840, Closer Connection Exception Statement for Aliens. Last checked by us on 24 November 2026.
- IRS: About Form 8843, Statement for Exempt Individuals and Individuals With a Medical Condition. Last checked by us on 24 November 2026.