Immigrants and international students

Nonresident alien for tax purposes: the substantial presence test explained

For US income tax, an alien is anyone who is not a US citizen or national, and a nonresident alien is an alien who has passed neither of two tests: the green card test or the substantial presence test. Your tax status does not follow your visa: an H-1B worker can be a resident alien in their first year, while an F-1 student is usually a nonresident for five years. Nonresidents file Form 1040-NR and are taxed only on US income; residents file Form 1040 and are taxed on worldwide income.

Test 1: the green card test

You are a resident alien for the year if you were a lawful permanent resident of the United States at any time during it, which generally means USCIS issued you a green card (Form I-551). You stay a resident under this test until you give up the status in writing to USCIS or it is terminated by USCIS or a federal court.

Test 2: the substantial presence test

You are also a resident alien if you were physically present in the United States on at least 31 days this year and at least 183 days over the last three years, counted this way: every day this year, plus a third of the days last year, plus a sixth of the days the year before.

Example B is the IRS’s own example. Days that do not count, such as exempt-individual days, are left out before adding.
ExampleThis yearLast year (÷3)Two years ago (÷6)TotalResult
A: worker on an H-1B150 days120 → 4090 → 15205Resident alien
B: frequent visitor120 days120 → 40120 → 20180Nonresident alien
C: F-1 student in year 30 counted (exempt)0 counted0 counted0Nonresident alien; file Form 8843

Days that do not count

A day counts if you were in the United States at any time during it, with these exceptions:

  • Days you commute to work in the US from a home in Canada or Mexico, if you commute regularly.
  • Days you are in the US for less than 24 hours while in transit between two places outside it.
  • Days you are in the US as a crew member of a foreign vessel.
  • Days you cannot leave because of a medical condition that developed while you were here.
  • Days you are an exempt individual (below).

Exempt individuals: F-1, J-1, M-1 and Q visas

"Exempt individual" does not mean exempt from tax. It means your days do not count toward the test. It covers students in F, J, M or Q status and teachers or trainees in J or Q status who substantially comply with their visa, foreign-government employees in A or G status (other than A-3 and G-5), and professional athletes in the US for a charitable sports event.

The exemption has limits. A student generally stops being exempt once they have been exempt as a student, teacher or trainee in any part of more than five calendar years. A teacher or trainee generally cannot be exempt if they were exempt in any part of two of the six previous calendar years. After that, days count and most people meet the test.

To exclude the days you must file Form 8843 for each year, with your tax return or on its own if you have no return to file. The IRS says that if you do not file it on time, you cannot exclude the days.

The closer connection exception

You can meet the substantial presence test and still be treated as a nonresident if you were in the US on fewer than 183 days this year, kept your tax home in one foreign country all year, had a closer connection to that country than to the US, and had not applied for or taken steps toward a green card. You claim it on Form 8840.

How a nonresident alien is taxed

A nonresident pays US tax only on US-source income and income connected with a US trade or business. Wages for work done here, and the taxable part of a scholarship, are taxed at the same graduated rates as everyone else, after allowable deductions. Other US-source investment-type income, such as dividends, is generally taxed at a flat 30% unless a tax treaty lowers the rate.

Nonresidents file Form 1040-NR. There is no joint return and generally no standard deduction, and many credits are not available. Students and scholars in F, J, M or Q status generally do not pay Social Security and Medicare tax on allowed work while they are nonresidents.

A year in which you change status, usually the year you arrive or leave, is a dual-status year, with resident rules for part of the year and nonresident rules for the rest.

Why it matters beyond your tax return

Your status decides more than which return you file:

  • Filing Form 1040 while you are a nonresident claims benefits you cannot take, and is fixed with an amended return.
  • A nonresident alien cannot own shares in an S corporation, so an LLC with a nonresident owner cannot elect S corp status.
  • Your bank and employer ask for Form W-8BEN (nonresident) or Form W-9 (US person); giving the wrong one changes the tax they withhold.

Not sure whether you are a resident or a nonresident?

We prepare Form 1040-NR, Form 8843 and dual-status returns for students, scholars and workers on visas, and work out your status from your travel dates. In person in Naperville, IL, by phone or by Zoom.

Questions people ask

What is a nonresident alien?

For US income tax, someone who is not a US citizen or national and does not meet the green card test or the substantial presence test for the year.

How do I count days for the substantial presence test?

Count every day you were in the US this year, a third of last year’s days and a sixth of the days from the year before. You are a resident if the total is at least 183 and this year’s days are at least 31. Leave out exempt-individual days and the other excluded days.

Is an F-1 student a nonresident alien?

Usually, for their first five calendar years in the US, because their days do not count toward the substantial presence test as long as they file Form 8843. After that the days count.

Is an H-1B worker a resident or a nonresident?

It depends on days, not the visa. Someone on an H-1B who is in the US for 183 days or more in a year meets the substantial presence test that year and is a resident alien.

Does a green card holder pay tax as a resident?

Yes. A lawful permanent resident is a resident alien for every year they hold that status at any time, wherever they live, until it is given up in writing or terminated.

What form does a nonresident alien file?

Form 1040-NR if they have US income subject to tax. Students, teachers and trainees who exclude days also file Form 8843, even with no income.

Where these rules come from

General information, current when written, not advice about your situation. Fees and forms change; the official pages above are the authority.

Read next

USTAXX app

Upload docs securely

Get the app
Nonresident Alien and the Substantial Presence Test | USTAXX