Skip to content
TaxWren
Next IRS deadline:Extended 2025 tax returns due ·

2026 tax year · updated

Substantial presence test calculator

Resident or nonresident alien for US tax? Count your days the IRS way, including the exempt years for students and J-1 researchers.

Any part of a year counts as a full year, even a few days.

Days you were physically in the US

Any part of a day counts as a day. Do not count days in transit for less than 24 hours, days commuting from Canada or Mexico, or days you could not leave because of a medical condition that arose in the US.

For US tax in 2026 you are

A nonresident alien

Your days in 2026 do not count because you are an exempt individual (student), so you cannot meet the substantial presence test this year.

Substantial presence test day count
YearDaysCountedTest days
2026300Exempt0
2025120Exempt0
202401/60
Total (resident at 183, with at least 31 this year)0

Social Security and Medicare

Exempt (F-1)

Federal return

Form 1040-NR + Form 8843

  • As a nonresident in F-1 status, wages for work your visa allows (on-campus jobs, OPT or CPT practical training) are exempt from Social Security and Medicare. If your employer withheld them, ask for a refund; if that fails, file Forms 843 and 8316.
  • If you stay in the same status, your days start counting in 2030.
  • File Form 8843 to exclude your exempt days, even with no income. If you file Form 1040-NR, attach it.

Assumes you stayed in the same status since the first year entered and complied with your visa. Tax treaties, dual-status years and the closer connection exceptions can change the result. Information only, not tax or immigration advice.

Report an error

Tell us what looks wrong. We attach this page and your calculator inputs so we can reproduce it.

How the substantial presence test works

If you are not a US citizen and do not have a green card, you are a resident alien for tax purposes in a year when you were in the US on at least 31 days that year and at least 183 days over three years, counting:

  • all the days in the current year,
  • 1/3 of the days in the year before,
  • 1/6 of the days two years before.

Example: 120 days in each of 2024, 2025 and 2026 count as 120 + 40 + 20 = 180 days, fewer than 183, so that person is a nonresident for 2026.

Days that do not count

  • Days as an exempt individual: students on F, J, M or Q visas, and teachers or trainees on J or Q visas, who comply with their visa (plus certain diplomats, international organization staff and athletes at charity events).
  • Days commuting to work from a home in Canada or Mexico, if you commute regularly.
  • Days in transit between two places outside the US, for less than 24 hours.
  • Days as a crew member of a foreign vessel.
  • Days you could not leave because of a medical condition that started in the US.

To exclude exempt or medical days you generally must file Form 8843.

How long are students and researchers exempt?

Students (F, J, M, Q) are exempt individuals unless they have been exempt for any part of more than 5 calendar years. Any part of a year counts as a full year, so a student who arrives in late December has used one of the 5 years. After that, a student can stay exempt only by showing the IRS they do not intend to live in the US permanently.

When F-1, J-1 and M-1 students start counting days
First year in the US as a studentExempt yearsDays start counting
20262026–20302031
20252025–20292030
20242024–20282029
20232023–20272028
20222022–20262027

Teachers, researchers and trainees on J or Q visas are not exempt in a year if they were exempt (as a teacher, trainee or student) for any part of 2 of the 6 previous calendar years. For someone who arrives on a J-1 and stays, that usually means two exempt calendar years. A narrow exception applies when a foreign employer pays all their compensation.

Social Security and Medicare for F-1, J-1 and M-1

Nonresident aliens in F-1, J-1, M-1 status are exempt from Social Security and Medicare (FICA) on wages for work their status allows: on-campus jobs (up to 20 hours a week in term, 40 in vacations), off-campus work USCIS authorizes, and practical training such as OPT and CPT. The exemption does not cover F-2, J-2 or M-2 dependents, and it ends when you become a resident alien or change to another status such as H-1B. If FICA was withheld by mistake, ask your employer for a refund first; if you cannot get it, file Form 843 with Form 8316.

What changes when you become a resident alien?

You file Form 1040 instead of Form 1040-NR and report your worldwide income, and Social Security and Medicare apply to your wages. The first year can be a dual-status year, and a tax treaty can change the result in some cases. Our take-home pay calculator and income tax calculator use resident tax rules, so they fit once you are a resident alien.

Sources: IRS, Substantial presence test; IRS, Exempt individual: who is a student; IRS, Exempt individuals: teachers and trainees; IRS, Foreign student liability for Social Security and Medicare taxes.

Frequently asked questions

How many days can I stay in the US without becoming a tax resident?

Fewer than 31 days in the current year never makes you a resident under the test. Beyond that it depends on the two previous years: someone in the US the same number of days every year meets the test at 122 days a year (121 days a year stays under it). Days as an exempt individual, such as an F-1 student in the first 5 calendar years, do not count.

Do F-1 students on OPT pay Social Security and Medicare?

Not while they are nonresident aliens. F-1, J-1 and M-1 students who are nonresidents are exempt from Social Security and Medicare on work their status allows, including OPT and CPT practical training. Once they become resident aliens, usually in their 6th calendar year in the US, the exemption ends.

Does the substantial presence test apply to H-1B workers?

Yes. H-1B, L-1, O-1, TN and other work visa holders are not exempt individuals, so every day in the US counts. Most H-1B workers who live in the US all year meet the test in their first full year.

Is a J-1 researcher a resident alien for tax purposes?

J-1 teachers, researchers and trainees are exempt individuals, but not if they were exempt for any part of 2 of the 6 previous calendar years. In practice their days usually stop being exempt in their third calendar year in the US, and they can then meet the test.

Do I count the day I arrive in the US?

Yes. You are present on any day you are physically in the US at any time during the day, so the days you arrive and leave both count, unless you were only in transit for less than 24 hours.