US Substantial Presence Test: Full Guide

By John from the Nomad TeamApril 27, 2026
US Substantial Presence Test: Full Guide

You are a US tax resident for any year you meet either the green card test or the substantial presence test. The substantial presence test triggers if you are physically present in the US for at least 31 days in the current year AND 183 weighted days across the current year (full count), the prior year (one-third count), and two years prior (one-sixth count). Once you meet this threshold, the IRS taxes your worldwide income, not just your US-source earnings, unless you qualify for the closer connection exception (Form 8840) or a tax treaty tiebreaker. Non-US citizens on B, F, J, M, or Q visas, and US nomads helping foreign family, need to understand this test precisely - the weighted math catches more people than the simple "183 days" phrase suggests.

Most travelers hear "183 days" and assume the US uses the same cutoff as Portugal, Spain, or the UK. It does not. The substantial presence test is a three-year weighted formula defined in Internal Revenue Code section 7701(b) and explained in IRS Publication 519. Miss the math by a single day and you can become a US tax resident without ever filing for a green card.

This guide is for non-US citizens who spend meaningful time in the US each year, and for US citizens or green card holders trying to understand how the rule applies to their spouses, employees, or travel companions. It is not a substitute for professional tax advice. If you are within 10 days of the 183-day threshold, stop reading and call a cross-border tax attorney.

The sections below cover the exact formula with a worked example, which days count and which do not, the closer connection exception, treaty tiebreakers, state-level tax residency, consequences when you become a US tax resident, and common scenarios. A full FAQ is at the end.

How the substantial presence test works

The substantial presence test is a two-part threshold. You must satisfy both parts in the current calendar year to be classified as a US tax resident under this test, per IRC § 7701(b)(3) and IRS Topic 851.

Part 1: the 31-day gate. You must be physically present in the US for at least 31 days during the current calendar year. Fewer than 31 days and the test does not apply at all, regardless of prior years.

Part 2: the 183-day weighted formula. Add these three numbers together:

  • All days of physical presence in the current year (each counts as one full day)
  • One-third of the days of physical presence in the prior year
  • One-sixth of the days of physical presence two years prior

If that total equals or exceeds 183, Part 2 is met. If both parts are met, you are a US tax resident for the current year unless an exception applies.

This weighting is the trap. You can spend well under 183 days in the current year and still cross the threshold because prior-year days keep counting forward at reduced weight.

Example: Calculating substantial presence

Maria, a Mexican citizen on a B-1/B-2 visa, spent these days in the US:

  • 2026 (current year): 130 days
  • 2025: 120 days
  • 2024: 120 days

Part 1: She was present 130 days in 2026, so the 31-day gate is met.

Part 2: 130 + (120 / 3) + (120 / 6) = 130 + 40 + 20 = 190 days.

190 exceeds 183, so Maria is a US tax resident for 2026. She owes US tax on her worldwide income for the year unless she qualifies for the closer connection exception or a treaty tiebreaker.

Compare this to the plain 183-day rule used by most countries, which counts only the current year. The US is one of the stricter jurisdictions precisely because of the three-year lookback.

Days that count and days that do not

Not every day of physical presence counts. The IRS excludes specific categories in Publication 519, Chapter 1.

Days that count:

  • Any day you are physically present in the US at any point, even for a few hours
  • The day you arrive and the day you depart
  • Days spent working, vacationing, visiting family, or passing through

Days that do not count (exempt days):

  • Transit days when you are in the US for less than 24 hours while traveling between two foreign points. Your feet touching a connecting airport gate does not trigger a counted day if you never clear immigration for onward travel.
  • Commuting days for regular commuters from Canada or Mexico traveling to work in the US (specific conditions apply).
  • Days as a crew member of a foreign vessel.
  • Medical-condition days when you intended to leave but could not because of a medical condition that arose while in the US. File Form 8843 to claim this exception.
  • Exempt individual days for people on specific visa categories, discussed below.

Exempt individuals under the test (days in these categories do not count at all):

  • F, J, M, or Q visa holders classified as students, generally exempt for the first 5 calendar years in any status.
  • J or Q visa holders classified as teachers or trainees, generally exempt for 2 of the last 6 calendar years.
  • Foreign government-related individuals on A or G visas (with limits).
  • Professional athletes temporarily in the US for a charitable sports event.

Exempt individuals must still file Form 8843 each year to claim the exemption, even if they owe no tax.

The closer connection exception (Form 8840)

The closer connection exception lets some people who meet the substantial presence test avoid US tax residency by proving they have a closer connection to another country. It is governed by IRC § 7701(b)(3)(B) and claimed on Form 8840.

To qualify, all four conditions must be true:

  1. You were present in the US for fewer than 183 days in the current year. The exception is not available if you hit 183+ days in the current year alone, regardless of the weighted total.
  2. You maintained a tax home in a foreign country for the entire year.
  3. You had a closer connection to that foreign country than to the US.
  4. You have not applied for a green card or taken any steps toward becoming a lawful permanent resident.

The IRS considers several factors when evaluating "closer connection," including the location of your permanent home, family, personal belongings, social and religious affiliations, business activities, driver's license, voter registration, and where you file tax returns as a resident.

File Form 8840 with your Form 1040-NR by the due date (generally June 15 for non-residents). If you fail to file on time, the IRS can deny the exception and treat you as a US tax resident for the year.

Tax treaty tiebreakers

If you cannot claim the closer connection exception but your home country has a tax treaty with the US, you may still avoid US tax residency through a treaty tiebreaker. The US has tax treaties with roughly 65 countries, including the UK, Canada, Germany, France, Japan, Australia, Mexico, India, and most of the EU.

Treaty tiebreakers apply when you are a tax resident of both countries under their domestic laws. The treaty provides an ordered test to assign residency to one country for treaty purposes. Typical tiebreaker order:

  1. Permanent home - where do you have a home available to you year-round?
  2. Center of vital interests - where are your personal and economic ties closer?
  3. Habitual abode - where do you actually live most of the time?
  4. Nationality - which country are you a citizen of?
  5. Mutual agreement - the two countries' tax authorities negotiate.

Claim a treaty tiebreaker by filing Form 8833 with your US return. This is complex. A treaty position filed incorrectly can trigger audit and penalties. If you think you need a treaty position, hire a qualified cross-border tax professional.

One critical note: US citizens and green card holders cannot use treaty tiebreakers to escape US taxation on worldwide income, per the "saving clause" in most US tax treaties. The tiebreaker only helps non-citizens without permanent resident status.

Consequences of being deemed a US tax resident

Becoming a US tax resident under the substantial presence test triggers three major obligations most non-citizens do not anticipate.

Worldwide income taxation. The US taxes residents on their worldwide income, not just US-source income. That includes foreign salary, foreign rental income, foreign investment gains, foreign pension distributions, and foreign business profits. You file Form 1040 (not 1040-NR), and you can claim foreign tax credits for taxes paid abroad to reduce double taxation.

FBAR (Foreign Bank Account Report). If the aggregate value of your foreign financial accounts exceeded $10,000 at any point in the year, you must file FinCEN Form 114 by April 15 with an automatic extension to October 15. Willful failure to file carries civil penalties up to the greater of $100,000 or 50% of the account balance, plus potential criminal penalties.

FATCA reporting (Form 8938). If your foreign financial assets exceed threshold amounts (starting at $50,000 for single filers living in the US), you must file Form 8938 with your tax return. This is separate from FBAR and has different thresholds.

Additional consequences: you become subject to the net investment income tax, the additional Medicare tax, and PFIC rules that can make foreign mutual funds punitively taxed. State tax may also apply, covered in the next section.

State tax residency is a separate question

The substantial presence test determines federal tax residency only. Every state sets its own residency rules, and you can be a resident of a state without being a federal resident (or vice versa).

States generally use one of three tests:

  • Domicile test - where you intend your permanent home to be. Used by most states as the primary test.
  • Statutory residency test - a day-count threshold, often 183 days combined with a "permanent place of abode" in the state. New York, California, Massachusetts, and New Jersey are aggressive on this.
  • Source-based taxation - you owe state tax on income earned in the state regardless of residency.

Some states have no income tax (Florida, Texas, Washington, Nevada, Tennessee, New Hampshire, South Dakota, Wyoming, and Alaska). If you spend time in a high-tax state, you need to count those days separately from your federal count.

US citizens abroad still face state residency issues. California in particular can claim you as a tax resident for years after you move if you keep property, a driver's license, or voter registration in the state.

How to document your days

The IRS puts the burden of proof on the taxpayer. If audited, you must produce contemporaneous records showing which days you were in the US and which you were not. Common evidence includes passport stamps, boarding passes, credit card statements from foreign merchants, hotel receipts, and travel booking confirmations.

Nomad (the visa compliance app for digital nomads) tracks every US entry and exit automatically using your phone's location data and airline arrival confirmations. The app computes your running substantial presence total across the three-year window in real time and alerts you before you cross the 183-day weighted threshold. Travel dates and country borders sync to cloud; passport numbers stay on your device.

For an audit, Nomad exports a PDF day-log showing every entry, exit, and day-count calculation. This is the same documentation a CPA would manually reconstruct from your passport and airline records, produced automatically and time-stamped.

Download Nomad on the App Store

Common scenarios

Scenario 1: The B-visa business visitor. Kenji is a Japanese executive on a B-1 visa. He visits the US three times a year for 40 days each (120 total). In prior years he did the same. His Part 2 total: 120 + 40 + 20 = 180 days. He is just under the threshold for 2026. If he adds one more 10-day trip, he becomes a US tax resident and owes US tax on his Japanese salary. Small schedule changes have five-figure tax consequences.

Scenario 2: The remote worker spending summers in the US. Elena lives in Portugal and works remotely for a European company. She spends four months (June through September, roughly 120 days) with family in the US each year. Year-one Part 2: 120 days. Year-two: 120 + 40 = 160. Year-three: 120 + 40 + 20 = 180. Year-four: 120 + 40 + 20 = 180 and she remains just under. If she extends any summer by two weeks, she crosses the line. She should file Form 8840 each year her US days approach 120+ to preserve the closer connection defense.

Scenario 3: The dual-status year. Marcus moved from Germany to the US on a work visa on July 1, 2026, and plans to stay permanently. From January to June he was a non-resident. From July onward he meets substantial presence through his intended multi-year stay. He files a dual-status return: Form 1040-NR for the first half of the year (US-source income only) and Form 1040 for the second half (worldwide income). Dual-status returns are mechanically complex and restrict several deductions. Most taxpayers in this situation benefit from professional help.

For background on how different countries apply day-count rules, compare this to how the Schengen 90/180 rule works for non-EU travelers. The Schengen rule is a rolling window for immigration, not tax. The US substantial presence test is an annual tax classification with a multi-year lookback. The two often get confused.

Frequently Asked Questions

What is the 31-day rule in the substantial presence test?

The 31-day rule is the first of two gates you must pass to be classified as a US tax resident under the substantial presence test. If you were physically present in the US fewer than 31 days in the current calendar year, the test does not apply at all, regardless of how many days you spent in prior years. Only after passing the 31-day gate does the IRS apply the weighted 183-day formula across the current year and the two prior years. Both parts must be satisfied for US tax residency to attach.

Do I count the day I arrive and the day I leave?

Yes. The IRS counts any day you are physically present in the US at any time, which includes both the arrival day and the departure day, per IRS Publication 519. A same-day layover at a US airport while traveling between two foreign countries does not count, provided you are in the US for less than 24 hours and do not attend business meetings or otherwise engage beyond transit. Keep boarding passes as evidence if you rely on the transit exception.

What is Form 8840 and when do I file it?

Form 8840 is the Closer Connection Exception Statement for Aliens. File it if you meet the substantial presence test but want to claim that your tax home and closer connections are in another country, exempting you from US tax residency. You must have been present fewer than 183 days in the current year, maintained a foreign tax home, and taken no steps toward a green card. File with your Form 1040-NR by the due date, generally June 15 for non-residents. Late filing can forfeit the exception.

Does the substantial presence test apply to US citizens?

No. US citizens are subject to US tax on worldwide income regardless of where they live or how many days they spend in the US, under the citizenship-based taxation system. The substantial presence test determines whether a non-citizen becomes a US tax resident. US citizens also cannot use tax treaty tiebreakers to escape US taxation, because of the "saving clause" in most treaties. Green card holders are similarly taxed on worldwide income from the date their status is granted until it is formally abandoned.

How does the IRS know how many days I spent in the US?

US Customs and Border Protection records every entry and exit at air and sea ports through the APIS system, and CBP shares this data with the IRS on request. Land border crossings are less consistently logged but are still tracked through passport scans and the I-94 system. The IRS can also request bank records, employer records, and credit card statements during an audit. Assume every US entry is recorded. Your own records should match the government's.

What happens if I become a US tax resident by accident?

If you cross the substantial presence threshold without planning for it, you owe US tax on your worldwide income for the year, plus potential FBAR and FATCA reporting on foreign accounts and assets. Penalties for unfiled FBARs and FATCA forms can be severe. Options include filing Form 8840 to claim the closer connection exception (if you still qualify), filing a treaty-based position via Form 8833, or entering the IRS Streamlined Filing Compliance Procedures if the failure was non-willful. Speak to a cross-border tax attorney before filing anything.

Are F-1 student days exempt from the substantial presence test?

Generally yes, for the first five calendar years in the US. F-1 visa holders are classified as "exempt individuals" whose days do not count toward the substantial presence test during that window, per IRS guidance on exempt individuals. After five calendar years, F-1 holders start counting days normally unless they can prove continued non-immigrant intent. All F-1 students, even those owing no tax, must file Form 8843 each year they claim exempt status. Missing Form 8843 can forfeit the exemption.

Can I be a tax resident of the US and another country at the same time?

Yes. You can be a dual tax resident under each country's domestic law. If both countries have a tax treaty, the treaty's tiebreaker rules assign residency to one country for treaty purposes, which then determines where you primarily owe tax on various income types. Without a treaty, you may face double taxation softened only by foreign tax credits. Dual residency is common for nomads who split time between the US, the UK, Canada, Australia, Portugal, or Spain, and it almost always requires professional tax advice.

Does time in US territories like Puerto Rico count?

Puerto Rico, Guam, the US Virgin Islands, American Samoa, and the Northern Mariana Islands are not part of the United States for substantial presence test purposes. Days spent in these territories do not count toward the 183-day weighted total. However, each territory has its own tax system with its own residency rules, and bona fide residents of Puerto Rico in particular face specific federal tax rules under IRC § 933. If you split time between the mainland US and a territory, consult a tax professional who handles both jurisdictions.

How close to the threshold is too close?

Any year you project above 160 weighted days deserves professional review. The calculation is sensitive to travel changes, and a single unexpected week in the US can cross the line. If you are within 20 weighted days of 183, file Form 8840 prophylactically to preserve the closer connection defense, keep contemporaneous records of every trip, and speak to a cross-border tax advisor before December 31 so you still have time to adjust your travel.

Sources

About Nomad

Nomad is the visa compliance app for digital nomads. Built by nomads for nomads, it tracks your days across every country automatically, alerts you before overstays, and keeps passport details on your device for privacy. The in-app AI assistant answers visa questions in plain English. Available on iOS.

Download Nomad on the App Store

Important: This content is informational and does not constitute legal, tax, or immigration advice. Visa rules, tax regulations, and entry requirements change frequently and vary by individual circumstances. Always verify current requirements with official government sources or a qualified professional before making travel decisions. Nomad tracks your days and surfaces compliance information, but final responsibility for compliance rests with the traveler.

Download Nomad
★★★★★4.8 - Join 1,000+ digital nomads