How many days do you have to be in the US to be a tax resident?
Under the IRS substantial presence test you are generally a US tax resident if you are present at least 31 days in the current year and at least 183 days over three years, counting all current-year days, one third of last year's and one sixth of the year before.
The substantial presence test, step by step
For people who are not US citizens or green card holders, the IRS uses the substantial presence test. You meet it for a calendar year if both of these are true: you were physically present in the US on at least 31 days during the year, and the sum of all your days this year, plus one third of your days in the first preceding year, plus one sixth of your days in the second preceding year, equals 183 days or more.
For example, 120 days in each of three years gives 120 + 40 + 20 = 180, which is under 183. Add a few more days in the current year and you cross the line, even though you never spent half of any single year in the US.
Days that do not count
The IRS generally counts any day you are present at any time, even part of a day. Some days are excluded, including days commuting to work from Canada or Mexico, days in transit between two foreign points for less than 24 hours, some days as a crew member of a foreign vessel, days you could not leave because of a medical condition that arose in the US, and days as an exempt individual (such as certain students, teachers and trainees on F, J, M or Q visas, who generally file Form 8843).
If you pass the test
Meeting the test is not always the end of the story. If you were present fewer than 183 days in the current year and you keep a tax home and a closer connection to a foreign country, the closer connection exception on Form 8840 may let you be treated as a nonresident. A tax treaty tie-breaker can also apply. Publication 519 covers the full rules. Run your own numbers in the calculator below.
Sources & further reading
Every rule on this page is drawn from primary sources. Verify the current law before making a residency decision.
Stop counting days by hand
Tax Days keeps a live day count across every US state, federal SPT, Schengen, and 200+ countries, using each one's own rules.