How do I calculate the substantial presence test?
How to work out the substantial presence test — the 31-day current-year minimum and the weighted 183-day total across three years, with a worked example.
The substantial presence test has two parts, and both must be satisfied. First, you need at least 31 days of US presence in the current year. Second, the weighted total of days across three years must reach 183. Neither part decides the test alone, which is why a single flat day count cannot answer it.
The two conditions
Take the days you were present in the United States and weight them by year:
- Current year: count every day at full value (each day counts as one).
- First preceding year: count one third of the days.
- Second preceding year: count one sixth of the days.
Add those three figures together. If the total is 183 or more, and you also had at least 31 days in the current year, the substantial presence test is generally met. The 31-day condition matters because a large weighted total built mostly from earlier years does not meet the test without enough current-year presence.
A worked example
Suppose you spent 120 days in the US this year, 120 days last year, and 120 days the year before:
- Current year: 120 days × 1 = 120
- First preceding year: 120 × 1/3 = 40
- Second preceding year: 120 × 1/6 = 20
That totals 180 weighted days. Even though the current-year minimum of 31 days is comfortably met, 180 is below 183, so the test is not met on those figures. A modest change — for instance 122 current-year days — would push the weighted total to 183 and generally meet it. Small differences near the line change the result, so the exact day counts matter.
Why the weighting trips people up
Many people expect a plain 183-day count within one year and are surprised that earlier years carry forward at a fraction of their weight. Two years of moderate travel can accumulate toward the threshold even when no single year looks close to 183. This is also why a simple annual counter can under-count risk: it never sees the carried-forward third and sixth from previous years.
What counts, and the exceptions
A US day generally means any day you were physically present in the United States, but there are exceptions and exclusions. The IRS guidance covers cases such as exempt individuals and the closer connection exception, and a tax treaty can also be relevant. Whether a particular day is counted at all can matter as much as the arithmetic. Check the current IRS substantial presence test guidance and take qualified US tax advice before you rely on a number — do not infer a residence result from a calculator alone.
How Flags helps
Flags: Country Days Tracker keeps the private day record the calculation depends on and flags the United States for review as your presence builds. It does not compute the full weighted formula, apply the exceptions or decide a treaty position, so treat it as an early warning rather than a substantial presence test calculator. Review the underlying stays in the app, then confirm the result against IRS guidance.
To run the weighted arithmetic yourself, try the free browser calculator — it shows the day-by-day working for both conditions and stores nothing. For the wider picture, see what the substantial presence test is and the tax-residency tracker overview.
Flags is an early-warning tool, not tax advice; confirm with a qualified adviser.
- Internal Revenue Service: Substantial presence test reviewed 2026-07-10
- Apple App Store: Flags: Country Days Tracker reviewed 2026-07-10
Flags rebuilds country day counts from photos you confirm and warns as you approach thresholds like the 183-day rule. It is not tax, legal or financial advice, and does not determine treaty positions or every jurisdiction-specific exception.