"183 days" is the number people remember, but for US tax residency it is a weighted total over three years, and a second threshold of 31 days must be met in the current year as well. This guide summarises the IRS description of the test. It is general information, not tax advice; other countries use different rules.
According to the IRS page on the substantial presence test, you are treated as a US tax resident for a calendar year if you are present in the US on at least:
The IRS example: 120 days of presence in each of 2023, 2024 and 2025. For 2025 that is 120 + 40 (one-third of 120) + 20 (one-sixth of 120) = 180. This is below 183, so the test is not met for 2025. At 122 days a year the total is 122 + 40.67 + 20.33 = 183, and the test is met.
Any day on which you are physically in the US at any time during the day counts. The IRS lists days that do not count, including regular commuting from Canada or Mexico, transit of less than 24 hours between two places outside the US, days as crew of a foreign vessel, days you could not leave because of a medical condition that arose while in the US, and days as an "exempt individual".
Certain groups do not count their days: foreign government-related individuals on A or G visas (not A-3 or G-5), teachers and trainees on J or Q visas, and students on F, J, M or Q visas, in each case if they substantially comply with their visa conditions. The IRS stresses that this term does not mean the person is exempt from US tax. If you exclude days as an exempt individual or for a medical condition, Form 8843 is required, and filing it late can lose the exclusion.
You can still be treated as a nonresident through the closer connection exception, and tax treaties may change the result. Those depend on your facts, so confirm with the IRS or a qualified adviser.
Use the tax days counter to total days per country from your travel dates, then apply the weighting by hand. For Schengen stays, which use a different 90/180 rule, see the Schengen guide.
Source: IRS, "Substantial presence test" (irs.gov/individuals/international-taxpayers/substantial-presence-test), read 2026-10-24. Rules and thresholds can change; check the current page. This guide covers the US test only.