US Substantial Presence Test — the real 183-day rule
us_substantial_presence_testWhether your US days make you a tax resident — the weighted 3-year formula where 122 days a year is enough, and student-visa days may not count at all. Determines US tax residency under the Substantial Presence Test (IRC §7701(b)): 31+ days this year AND a weighted total ≥ 183, counting this year’s days in full, last year’s at one-third, and the year before at one-sixth. The popular "stay under 183 days" rule is wrong — a steady 122 days every year triggers residency. The inputs that actually decide the answer are the ones people don’t know matter: visa status (F/J/M/Q student and J/Q teacher days can be excluded entirely — or suddenly start counting), prior-year day counts, and whether the closer connection exception (Form 8840) is still open — it closes at 183 actual days, and a pending green-card application bars it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | US immigration status this year The decisive input, and the one almost nobody knows matters. A green card makes you a resident regardless of days. F/J/M/Q student and J/Q teacher visas can make your days NOT count at all — or, past a limit, suddenly count. Most work and visitor statuses (H-1B, L-1, B1/B2, ESTA) have no special rule: pick the first option. | none |
| daysPrior1 | No | Days in the US in the 1st preceding year Last calendar year’s day count, same counting rules. It is weighted at one-third — prior years are why "under 183 this year" is not safe. | |
| daysPrior2 | No | Days in the US in the 2nd preceding year The calendar year before that, weighted at one-sixth. | |
| daysCurrent | No | Days in the US this calendar year Any part of a day counts as a full day — an evening arrival is a day. But first REMOVE days that never count: regular-commuter days from Canada/Mexico, under-24h transits between two foreign points, days as crew of a foreign vessel, and days you could not leave because of a medical condition that arose in the US. | |
| exemptYears | No | Exempt calendar years Only used for student/teacher status; two meanings. Student (F/J/M/Q): the calendar years you have EVER spent as an exempt student, teacher, or trainee — cumulative over your lifetime, any part of a year counts as a full year, and include this year if it applies. Teacher/trainee (J/Q): how many of the 6 PRECEDING calendar years you were exempt. | |
| closerConnection | No | Foreign tax home with a closer connection? If the test is met but you spent under 183 actual days, the closer connection exception can still keep you a nonresident: a tax home in a foreign country for the entire year plus a closer connection to it, claimed on a timely Form 8840. | unsure |