AllVisaUpdates VISA INFORMATION. MADE CLEAR. Follow on Telegram

Verified against official sources — 31 Oct 2026

Tax Residency and the Substantial Presence Test: Resident Alien or Nonresident for Tax Purposes?

NEW Published 31 October 2026

Illustration for tax residency and the substantial presence test

The two IRS tests that decide your tax status, the day-count formula worked step by step, the exempt years for students and researchers, the closer connection escape route, and what changes when your tax status flips.

Every non-citizen in the United States is either a resident alien or a nonresident alien for tax purposes, and the IRS decides which — not your visa. The classification controls which return you file and whether the United States taxes only your U.S. income or your income from everywhere. The IRS applies two tests: the green card test and the substantial presence test, a weighted count of your days in the country over three years. This guide works through both tests exactly as the IRS states them, explains why students and researchers get years in which their days do not count, and covers the closer connection exception for people who meet the day count but whose lives remain based abroad. It sits alongside our wider guide to U.S. taxes for international students. Items are labelled RULE (an official requirement) or ADVICE (a preparation tip).
Quick answer

You are a resident alien for tax purposes if you meet either of the IRS's two tests. The green card test: you are a lawful permanent resident at any time during the calendar year. The substantial presence test: you are present on at least 31 days in the current year, and on at least 183 days across a three-year count — all of the current year's days, plus 1/3 of the days in the year before, plus 1/6 of the days in the year before that. Days spent as an "exempt individual" — most students in their first five calendar years, and teachers and researchers within their limit — do not count, but you must file Form 8843 every year to protect that exclusion, even with no income. Tax residency is separate from immigration status: meeting the test changes your tax return, never your visa.

SECTION 01Two Different Questions: Your Visa Status and Your Tax Status

RULE — The IRS runs its own classification. Immigration law decides your visa and your status in the United States. Tax law asks a different question: are you a resident alien or a nonresident alien for tax purposes? The IRS answers it with two tests — the green card test and the substantial presence test — and an alien is treated as a nonresident alien unless they meet one of them. Neither test asks what your visa is called, and neither result changes your immigration position. Our guide to visa, status and the Form I-94 explains the immigration side; this guide is the tax side of the same paperwork.

RULE — Meeting the test does not touch your status. An H-1B worker or a student in a later year of study who meets the substantial presence test becomes a resident alien for tax purposes — and remains exactly what they were for immigration purposes. Nothing about the day count extends a stay, authorises work, or converts a nonimmigrant into an immigrant. The reverse is equally true: being an exempt individual for the day count says nothing about your right to be in the country.

RULE — "Exempt" never means exempt from tax. The IRS is explicit that the term "exempt individual" does not refer to someone exempt from U.S. tax. It describes a person whose days of presence are left out of the substantial presence count. An exempt individual with U.S. income is taxed on it under the nonresident rules like anyone else in that position; only the day count is switched off.

SECTION 02The Green Card Test: Status Alone Decides

RULE — Lawful permanent residents are resident aliens. In the IRS's words, you are a resident for U.S. federal tax purposes if you are a lawful permanent resident of the United States at any time during the calendar year — this is the green card test. You generally hold that status if USCIS has issued you a Permanent Resident Card, Form I-551. No day count is involved: a permanent resident who spends the whole year abroad is still a resident alien for that year.

RULE — The status continues until it formally ends. The IRS lists three endings: you voluntarily renounce and abandon the status in writing to USCIS; USCIS administratively terminates it; or a U.S. federal court judicially terminates it. If you meet the green card test but not the substantial presence test for the year, your residency starting date is the first day on which you are present in the United States as a lawful permanent resident. Most readers of this guide will be decided by the day count in the next section instead — but this test is the first of the only two routes in.

SECTION 03The Substantial Presence Test: The Formula and a Worked Example

RULE — Two thresholds, both required. The IRS states the test exactly as follows. You will be considered a United States resident for tax purposes if you meet the substantial presence test for the calendar year. To meet it, you must be physically present in the United States on at least:

  • 31 days during the current year, and
  • 183 days during the 3-year period that includes the current year and the 2 years immediately before it, counting:
    • all the days you were present in the current year, and
    • 1/3 of the days you were present in the first year before the current year, and
    • 1/6 of the days you were present in the second year before the current year.

RULE — A day of presence is any part of a day. You are treated as present on any day you are physically present in the country, at any time during the day — subject to the exceptions in Section 04. The "United States" here means all 50 states and the District of Columbia, plus U.S. territorial waters; it does not include U.S. territories or U.S. airspace.

The IRS's own worked example. The IRS illustrates the count with a person who was physically present in the U.S. on 120 days in each of 2023, 2024 and 2025. For the 2025 test: count the full 120 days of presence in 2025, 40 days in 2024 (1/3 of 120), and 20 days in 2023 (1/6 of 120). The total for the 3-year period is 180 days — so, the IRS concludes, that person is not considered a resident under the substantial presence test for 2025.

ADVICE — An illustration of the same formula, crossing the line. Take a worker present for 150 days in each of three consecutive years. The count is 150 (current year) + 50 (1/3 of 150) + 25 (1/6 of 150) = 225 days — over 183, with the 31-day threshold met, so this person is a resident alien for tax purposes for the current year. This example is our arithmetic on the IRS formula above, not an IRS example.

SECTION 04Days That Do Not Count

RULE — The IRS lists the exclusions; only these. Do not count the following as days of presence in the U.S. for the substantial presence test:

  • Commuting days — days you commute to work in the U.S. from a residence in Canada or Mexico, if you regularly commute from Canada or Mexico.
  • Transit days — days you are in the U.S. for less than 24 hours, when you are in transit between two places outside the United States.
  • Crew days — days you are in the U.S. as a crew member of a foreign vessel.
  • Medical days — days you are unable to leave the U.S. because of a medical condition that develops while you are in the United States.
  • Exempt-individual days — days for which you are an exempt individual, the subject of Section 05.

RULE — Exclusions must be claimed on a form. If you exclude days because you were an exempt individual, or because a medical condition kept you in the country, you must include Form 8843 with your income tax return — or, if you do not have to file a return, send it to the address in its instructions by the return due date. Section 05 returns to this form, because it is the one obligation students most often miss.

SECTION 05Exempt Individuals: The Student Years, and the Researcher Limit

RULE — Who is an exempt individual. The IRS lists four categories: a foreign government-related individual temporarily present under an "A" or "G" visa (other than "A-3" or "G-5"); a teacher or trainee temporarily present under a "J" or "Q" visa who substantially complies with the requirements of the visa; a student temporarily present under an "F", "J", "M" or "Q" visa who substantially complies; and a professional athlete temporarily in the U.S. to compete in a charitable sports event. Immediate family members whose status derives from the exempt individual's — a spouse and unmarried children under 21 who live regularly in the household — are included. "Substantially complies" means, in the IRS's explanation, that you have not engaged in activities prohibited by U.S. immigration laws that could result in the loss of your nonimmigrant status.

RULE — Students: five calendar years, then the days start counting. A student is an individual temporarily in the United States on an "F", "J", "M" or "Q" visa for the primary purpose of studying. You will not be an exempt individual as a student if you have been exempt as a teacher, trainee, student, Exchange Visitor or Cultural Exchange Visitor on an "F", "J", "M" or "Q" visa for any part of more than 5 calendar years — unless you establish to the satisfaction of the IRS that you do not intend to reside permanently in the United States, and you have substantially complied with the requirements of your nonimmigrant status. The limit counts calendar years in which you were exempt for any part of the year, across all those categories and visas together — a J-1 research year before your F-1 studies counts toward the same five. In practice, most F-1 students are nonresident aliens for their first five calendar years and start accumulating counted days from the sixth.

RULE — Form 8843 is annual, and it applies with no income at all. If you qualify to exclude days of presence as a student, you must file a fully-completed Form 8843 with the IRS — attached to your income tax return if you file one, and mailed on its own to the address in the form's instructions if you do not have to file a return. Its purpose, per the IRS, is to explain the basis of your claim to exclude days of presence. The consequence of skipping it is severe: if you do not timely file Form 8843, you cannot exclude the days you were present as an exempt individual — unless you can show by clear and convincing evidence that you took reasonable actions to become aware of the filing requirements and significant steps to comply with them. File it every exempt year, income or no income.

RULE — Teachers and researchers: a two-in-six lookback. A teacher or trainee is an individual, other than a student, temporarily present under a "J" or "Q" visa who substantially complies with its requirements — the category covering most J-1 researchers and scholars. You will not be an exempt individual as a teacher or trainee if you were exempt as a teacher, trainee or student for any part of 2 of the 6 calendar years preceding the current year. A narrow exception can restore the exclusion where the person was exempt for any part of 3 or fewer of those 6 years and a foreign employer paid all of their compensation; the IRS's teacher and trainee page, linked below, has the conditions. Form 8843 is required for these exempt years exactly as for students.

SECTION 06The Closer Connection Exception: Meeting the Count but Living Elsewhere

RULE — An escape route for the genuinely abroad-based. Even if you meet the substantial presence test, the IRS states you can still be treated as a nonresident of the United States for tax purposes if you qualify for the closer connection exception. Its conditions, as the IRS lists them:

  • You were present in the United States less than 183 days during the year — actual days, not the weighted count. This is the bar that excludes anyone who spent most of the year in the U.S., however strong their foreign ties.
  • You maintained a tax home in a foreign country during the entire year.
  • You had a closer connection to that foreign country than to the United States — decided on the facts and circumstances, including the location of your permanent home, family, personal belongings, social, political, cultural or religious affiliations, business activities, the jurisdiction of your driving licence, and where you vote.
  • You had not taken steps toward, and did not have an application pending for, lawful permanent resident status. The IRS lists the filings that show such intent, including Form I-485, Form I-130 and Form I-140.

RULE — It is claimed on Form 8840, and late filing loses it. You must file Form 8840, Closer Connection Exception Statement for Aliens, to claim the exception — attached to your tax return if you file one, or sent to the IRS Center shown in the form's instructions by the return due date if you do not. If you do not timely file Form 8840, you cannot claim the closer connection exception, subject to the same clear-and-convincing-evidence escape described for Form 8843 above.

RULE — Students have a second, separate route. The IRS notes that most foreign students cannot use the general exception, because of its 183-day presence bar and its requirement that their tax home be outside the United States. A separate exception exists for students only, with four requirements, all of which the student must prove: no intention to reside permanently in the United States; substantial compliance with the immigration laws and requirements relating to their student status; no steps taken to change their status toward becoming a lawful permanent resident; and a closer connection to a foreign country than to the United States. This is the route a long-term student examines once the five exempt years in Section 05 are used up; a student claims it on Form 8843 attached to Form 1040-NR, per the IRS's student page.

SECTION 07What Changes When You Become a Resident Alien for Tax Purposes

RULE — Worldwide income, on the resident return. A U.S. resident's income is generally subject to tax in the same manner as a U.S. citizen: the IRS states that residents' worldwide income is subject to U.S. tax and must be reported on their U.S. tax return — interest, dividends, wages, rental and royalty income and other types of income, whether earned within or outside the United States. Residents file Form 1040 (or Form 1040-SR), with the filing statuses, deductions, credits and graduated rates that apply to citizens. Nonresident aliens, by contrast, file Form 1040-NR and are taxed under the nonresident rules — broadly, on their U.S.-source income, as the dual-status page confirms for the nonresident part of a split year (Section 08). The practical shock for new residents is usually this: salary from a job back home, rent from a property abroad or interest on a home-country bank account becomes reportable in the U.S. in the year your status flips. Filing either return requires a U.S. taxpayer identification number; our guide to the ITIN explains the number used by people who are not eligible for a Social Security Number.

RULE — A tax treaty can re-decide residency, but that is a claim, not an automatic override. The IRS notes that most tax treaties contain an article defining tax residency for the purposes of the treaty, and that residency determined under a treaty's residency article may differ from the residency provisions of the Internal Revenue Code. Where a person is a tax resident of both countries, a treaty's tie-breaker rules may assign them to one — but outcomes are treaty-specific, and nothing in this guide applies any country's treaty to any reader's case. Treat this as a pointer to professional advice, not a result.

SECTION 08Dual-Status Years — and Keeping the Records That Prove Your Count

RULE — Arrival and departure years are often split years. You are a dual-status individual when you have been both a U.S. resident and a nonresident in the same tax year; dual status refers only to your resident status for tax purposes, not your citizenship, and the most common dual-status years are the years of arrival and departure. Different rules apply to each part: for the part of the year you are a U.S. resident, you are taxed on income from all sources; for the nonresident part, on income from U.S. sources only. The filing follows your status on the last day of the year — a resident at year-end files Form 1040 marked "Dual-Status Return" with a statement (Form 1040-NR may be used) for the nonresident part; a nonresident at year-end files Form 1040-NR marked "Dual-Status Return" with the resident part as the statement. One restriction worth knowing in advance: dual-status filers cannot use the standard deduction, though certain deductions may be itemised.

ADVICE — Keep a day log; it is the evidence everything rests on. The test is arithmetic on your travel history, and you may have to stand behind the numbers years later. Keep your own record of every entry and exit, and check it against your official Form I-94 travel history — our visa, status and I-94 guide shows how that record works and what to do if it is wrong. Keep copies of every Form 8843 and Form 8840 you file, with proof of mailing where you file on paper: those forms make your excluded days excludable, and the IRS's late-filing escape requires clear and convincing evidence of reasonable actions and significant steps — a paper trail is exactly that evidence.

FAQFrequently Asked Questions

If I meet the substantial presence test, does my visa change?

No. The test is a tax classification only. Meeting it makes you a resident alien for tax purposes — you file Form 1040 and report worldwide income — but your immigration status, authorised stay and work authorisation are entirely unaffected. The IRS's tests and the immigration system answer different questions; see Section 01.

I am an F-1 student in my third calendar year. Do my days in the U.S. count?

No — as an exempt individual, your days of presence are excluded from the count, so you remain a nonresident alien for tax purposes. Two conditions matter: you must substantially comply with your visa requirements, and you must file Form 8843 for the year even if you had no income at all — without a timely Form 8843, the IRS says you cannot exclude the days. See Section 05.

I spend about four months in the U.S. every year. Am I a tax resident?

On the IRS's own worked example, no — just. A person present 120 days in each of three consecutive years counts 120 + 40 (1/3) + 20 (1/6) = 180 days, three short of the threshold, and is not a resident under the test. A few extra current-year days would change the answer — hence the exact day log advised in Section 08.

What happens in my sixth calendar year as a student?

Your days start counting. The student exemption covers any part of no more than 5 calendar years as an exempt individual across the F, J, M and Q categories; beyond that, your presence counts toward the test unless you can establish to the IRS's satisfaction that you do not intend to reside permanently in the United States and you have substantially complied with your status. Students who meet the test may also examine the students-only closer connection exception in Section 06.

I met the test, but my home, family and life are abroad. Can I stay a nonresident?

Possibly, through the closer connection exception — but only if you were present on fewer than 183 actual days in the year, kept a tax home in the foreign country all year, had a closer connection to it than to the U.S., and have taken no steps toward a green card. It is claimed on a timely Form 8840; a late filing generally loses the exception. See Section 06.

Editorial note: This AllVisaUpdates guide is general educational information about U.S. tax residency classification. It is not tax advice — the substantial presence count turns on your individual travel history, exempt years and filings, and treaty positions are country- and fact-specific. Every RULE item comes from the IRS pages below, checked on 31 October 2026 (claim-by-claim record in the accompanying .sources.md file); the one worked example that is not the IRS's own is labelled as our arithmetic on the IRS formula. Confirm your classification before filing, and take case-specific questions to a qualified tax professional.

Official references and verification status

These official references were accessed and checked on 31 October 2026, and this guide's RULE items were verified claim-by-claim against them (record in the accompanying .sources.md file). Every source is irs.gov: tax residency is the IRS's determination, so no other agency's pages are needed or used. Two honest limits. First, IRS Publication 519, U.S. Tax Guide for Aliens — the IRS's detailed manual for this area, which several pages below refer readers to — was not fetched in full text in this pass; nothing in this guide rests on it, and readers who need its depth should use the current edition on irs.gov. Second, the closer connection and exempt-individual rules carry further conditions (for example, the teachers' foreign-employer exception, summarised but not reproduced in full in Section 05); the guide prints the headline conditions exactly as the IRS's pages state them and links those pages here for the detail.

General educational information, not individualized tax advice. Consult a qualified tax professional for case-specific questions.

General information only. This guide is based on official sources publicly available and checked on the date shown on this page. Visa rules change, and consular and USCIS officers decide every case on its own facts — nothing here is a confirmation or a guarantee for your individual case, and this is not legal advice. Always confirm the current requirement on the official page linked in this guide before you act, and consider a qualified immigration attorney for your specific situation.