Tax residency in the United States does not depend only on citizenship or visas. For many visitors, students, and workers, it depends on a day count called the substantial presence test, and that count reaches back three years. The Substantial Presence Test Calculator adds up your days in the United States with the official weighting: every day this year counts in full, one third of last year’s days count, and one sixth of the days from two years ago count.
If the weighted total reaches 183 days, and you spent at least 31 days in the United States during the current year, you generally meet the test and are treated as a resident for tax purposes. That single outcome changes which forms you file, how your worldwide income is treated, and what deductions you can claim, so getting the count right matters. The calculator does the weighting instantly and shows whether the threshold is met.
At a glance
- Current-year days count in full toward the weighted total
- Last-year days count at one third of their value
- Days from two years ago count at one sixth of their value
- The threshold is a weighted total of 183 days
- You also need at least 31 days in the United States this year
How the weighting works
The three-year lookback exists because residency should reflect a pattern of presence, not a single long trip. Counting only the current year would let someone spend five months in the United States every year without ever counting as resident, while counting every past day in full would punish people whose presence ended years ago. The one-third and one-sixth weights strike a balance: recent presence matters most, older presence fades, and a sustained pattern across years still adds up.
The arithmetic is simple once the weights are clear. Take your days this year, add last year’s days divided by three, then add the year-before days divided by six. A person with 120 days this year, 180 days last year, and 120 days two years ago gets 120 plus 60 plus 20, which is exactly 200 weighted days, comfortably above the 183-day threshold. The calculator handles the fractions for you, including awkward totals that do not divide evenly.
The 31-day rule
The 183-day threshold is only half the test. You must also have spent at least 31 days in the United States during the current year, and this rule catches a surprising edge case. Someone with 20 days this year but 365 days in each of the two previous years reaches a weighted total of about 202.5 days, yet still fails the test, because the current-year floor is not met. The calculator checks both conditions, so a high weighted total alone never produces a false pass.
Days are counted as calendar days of physical presence, and most days count even if you arrive late or leave early. Travel days, partial days, and days spent in the United States for medical treatment generally count, while a few narrow exceptions exist, such as days spent as an exempt individual under certain visa categories or days when you could not leave for medical reasons. The calculator counts the days you enter, so understanding which days belong in the count is part of using it correctly.
Exempt individuals and exceptions
Not everyone counts every day. Students on F, J, M, or Q visas are generally exempt individuals for their first five calendar years, and teachers and trainees on J or Q visas are generally exempt for their first two years. Foreign government-related visitors, professional athletes in certain charity events, and people with specific medical conditions that prevented departure may also have exempt days. These exceptions can change the result entirely, so anyone in an exempt category should work out their exempt days before entering numbers.
The closer-connection exception is another important escape hatch. Someone who meets the day count but is present for fewer than 183 days in the current year, has a tax home in another country, and can show a closer connection to that country may still be treated as a nonresident. Claiming it requires filing a statement with the tax return, and it is not available to everyone, but it matters for people who split their lives between two countries and would otherwise be caught by the test.
What residency changes
Meeting the test generally means filing as a resident, which usually means reporting worldwide income and filing the standard resident return rather than the nonresident return. Residents can often claim the standard deduction, file jointly with a spouse, and use credits that are limited or unavailable to nonresidents. The trade-off is broader reporting: foreign bank accounts, foreign assets, and income earned abroad all enter the picture in ways they might not for a nonresident.
Failing the test generally means nonresident treatment, where United States tax usually applies to United States-source income and the filing obligations are narrower. Neither outcome is automatically better, since the right result depends on income sources, treaty positions, and personal circumstances. The calculator answers only the day-count question, which is the starting point for everything else, not a complete tax plan.
Worked examples
Consider a consultant who spent 120 days in the United States this year, 180 days last year, and 120 days two years ago. The weighted total is 120 plus 60 plus 20, which equals 200 days, and the current-year count of 120 days clears the 31-day floor, so the test is met. Contrast that with a visitor who spent 30 days this year, 90 days last year, and 90 days two years ago: the weighted total is 30 plus 30 plus 15, which equals 75 days, well below the threshold, so the test is not met.
A third case shows why the 31-day rule matters. Someone with only 20 days this year but 365 days in each of the two prior years reaches a weighted total of about 202.5 days, which looks like a pass until the current-year floor is checked. Because 20 days is below 31, the test is not met despite the high weighted total. A fourth case is simpler: 200 days this year and nothing in the prior years gives a weighted total of exactly 200 days and meets the test on its own.
Common mistakes
The most common mistake is counting only the current year and missing the lookback entirely, which understates the total for anyone with regular United States travel. The next most common mistake is entering days as full years rather than actual days of presence, or counting days spent outside the United States on short trips as if they were inside. Both errors move the result, and both are easy to make when reconstructing travel from memory rather than from passport stamps and flight records.
Another frequent error is forgetting the exempt-individual rules and entering days that should not count at all, which overstates the total for students and trainees. The safest approach is to reconstruct presence from travel documents year by year, remove any exempt days, and then run the calculator. If the result sits near the 183-day line, treat it as a borderline case and get professional advice rather than assuming the answer.
Counting days in practice
Reconstructing three years of travel sounds daunting, but the records usually exist in more places than people expect. Passport stamps give entry and exit dates, airline accounts hold booking histories, and email confirmations preserve itineraries long after trips fade from memory. Bank and card statements can corroborate travel dates through foreign transactions, and employer travel records cover business trips that personal memory often drops. Assembling these sources year by year, rather than guessing totals, is the single best way to get the count right.
Edge cases deserve special attention because they are where counts go wrong. A trip that spans New Year midnight counts days in both years according to the calendar, not according to the trip, and a same-day border crossing still counts as a day of presence in the usual rule. Days spent in the United States while in transit to another country generally count, with a narrow exception for certain transit situations, and days when illness prevented departure may be excluded if the medical condition is properly documented. When in doubt, record the day and the reason, then let a professional decide whether it counts.
Dual-status years
Some people are residents for part of a year and nonresidents for the rest, which creates a dual-status year with special filing rules. This commonly happens in the year someone arrives in the United States and meets the test, or the year someone leaves permanently and stops meeting it. Dual-status filers generally cannot use the standard deduction in the same way as full-year residents, cannot file jointly in the usual manner, and face restrictions on credits, so the tax outcome differs from both pure resident and pure nonresident years.
The starting and ending dates of residency matter enormously in a dual-status year, because income is treated differently before and after the residency start or end date. A bonus, a stock sale, or a property transaction falling on one side of the line rather than the other can change the tax bill by thousands of dollars. The day-count calculator establishes the residency dates that frame these questions, but the filing itself needs professional handling, since dual-status returns are among the most error-prone filings in the system.
Students, trainees, and researchers
Students and trainees face the most complex version of the substantial presence test, because exempt-individual rules interact with the day count in ways that change over time. A student who arrives in August and stays through the academic year may spend five calendar years as an exempt individual, during which none of those days count, and then begin counting days in the sixth year as if newly arrived for tax purposes. The transition year catches many people by surprise, since presence that was irrelevant for years suddenly starts accumulating toward the threshold.
Researchers and visiting scholars on J visas face a shorter two-year exempt window in most cases, after which days count normally, and the change can coincide with a long-planned stay that pushes the weighted total over 183 days quickly. Both groups should track exempt years carefully from arrival, keep visa documents and programme letters that prove exempt status, and plan the transition year deliberately rather than discovering it at filing time. Universities often provide tax workshops for exactly this reason, and attending one beats reconstructing five years of travel alone.
Practical planning also involves the choice of filing position once residency begins. New residents may need to report foreign accounts they never considered taxable, may lose treaty benefits tied to nonresident status, and may face state tax rules that differ from federal ones. Early advice in the transition year, before the first resident return is due, prevents the most expensive mistakes, which usually involve omitted foreign reporting rather than the day count itself.
Frequently asked questions
What is the substantial presence test?
The substantial presence test is the day-count rule the United States uses to decide whether a foreign individual counts as a tax resident. It weights days over three years and treats a weighted total of 183 days, with at least 31 days this year, as meeting the test.
How are prior years weighted?
Days in the current year count in full, days from last year count at one third, and days from two years ago count at one sixth. The weighted total is the sum of those three parts, and the threshold is 183 days.
Why do I need 31 days this year?
The 31-day rule prevents someone with no real current-year presence from becoming resident on old days alone. Even a weighted total above 183 days fails the test if the current-year count is below 31 days.
Do partial days count?
In general, a day of physical presence counts even if you arrive late or leave early, with narrow exceptions for certain transit and medical situations. Keep travel records, since reconstructing partial days from memory is a common source of error.
Are students exempt from the test?
Students on F, J, M, or Q visas are generally exempt individuals for their first five calendar years, meaning those days do not count toward the test. After the exempt period ends, days start counting normally.
What is the closer-connection exception?
The closer-connection exception lets someone who meets the day count but spent fewer than 183 days this year, and who has a tax home and closer connection abroad, be treated as a nonresident. Claiming it requires filing a statement with the tax return.
Does meeting the test make me a resident for immigration?
No, tax residency and immigration status are separate systems. Meeting the substantial presence test affects tax filing only and does not change visa status, work permission, or the right to remain in the United States.
What happens if I meet the test?
Meeting the test generally means filing as a tax resident, reporting worldwide income, and using the resident return. It can also bring broader reporting duties for foreign accounts and assets, so the filing picture changes materially.
Can a tax treaty override the test?
Yes, a tax treaty tie-breaker can treat someone as a resident of the other country even if the day count is met, provided the treaty conditions are satisfied. Treaty claims require the proper forms and disclosure, so they need care.
How do I count days across a leap year?
Count actual calendar days of presence, including February 29 in a leap year. The weighting formula does not change for leap years, so a leap-year day counts exactly like any other day in its year.
What records should I keep for the day count?
Keep passport stamps, flight records, and travel itineraries for all three years, plus any documents supporting exempt days. The tax authority can ask for evidence, and reconstructed memories are far weaker than contemporaneous records.
Does time in Puerto Rico or territories count?
Presence in United States territories is generally not counted as presence in the United States for this test, though specific rules vary by territory and situation. Check the current guidance if a large part of your travel was to a territory.
What if my weighted total is exactly 183 days?
A weighted total of exactly 183 days meets the threshold, provided the 31-day current-year rule is also satisfied. Totals near the line deserve careful recounting, since a single miscounted day can flip the result.
Do I need to file anything if I fail the test?
Failing the test usually means nonresident treatment, which still may require a return if you have United States-source income. The test decides residency status, not whether any filing is needed at all.
Is this calculator tax advice?
No, this calculator performs the day-count arithmetic only and is not tax advice. Residency involves exemptions, treaties, and personal circumstances, so borderline or complex cases should go to a qualified tax professional.