The substantial presence test: 31 days and the 183-day weighted lookback

The IRS uses two day-count tests together. This page explains the formula in plain English and what the calculator on this site actually reports.

What the test is for

Under the IRS Substantial Presence Test page and Publication 519 (2025), you are considered a United States resident for tax purposes if you meet the substantial presence test for the calendar year — unless another rule changes that result, such as the closer connection exception or a tax treaty. This tool only applies the day-count portion of the test. It does not decide that you are a tax resident.

The two counts that both have to be met

To meet the test, you must be physically present in the United States on at least:

  1. 31 days during the current year, and
  2. 183 days during the 3-year period that includes the current year and the two years immediately before that, counting:
    • all the days you were present in the current year, and
    • 1/3 of the days you were present in the first year before the current year, and
    • 1/6 of the days you were present in the second year before the current year.

If either part fails, the day-count test is not met. For example, 200 days last year and 20 days this year would not meet the current-year 31-day test, even though the weighted total might be high.

What counts as a day of presence

You are generally treated as present in the United States on any day you are physically present in the country at any time during the day. For this test, “United States” includes the 50 states, the District of Columbia, and U.S. territorial waters (and certain adjacent seabed). It does not include U.S. territories or U.S. airspace.

Some days may be excluded — for example, certain regular commutes from Canada or Mexico, transit of less than 24 hours, specified medical conditions, and days as an exempt individual. See days that may not count and the Canada and Mexico commuter guide. This calculator does not automatically apply those exceptions. You can optionally mark a U.S. date range with an exception; the tool does not test whether you actually qualify.

How to use the calculator

Choose the tax year under review and enter travel ranges, not just single days. For the substantial presence test the tool uses the review year and the two prior years, so leave those years blank only if you truly had no U.S. days. Unspecified days are not counted as U.S. presence, which can understate the result if the calendar is incomplete.

The results show the current-year count, the 1/3 and 1/6 figures, and the weighted total. Publication 519 and the IRS substantial presence page do not state a rounding rule for fractional days. This tool keeps exact fractions and treats the 183-day test as met only if the exact total is at least 183.

For a numeric walkthrough of the official IRS example, see SPT lookback years. If you also care about Form 8840 or the foreign earned income exclusion, read one calendar, three tests.

Open the calculator

Enter your travel calendar once. All day-count math runs in your browser.