The weighting is the part people get wrong. Because the two earlier years are discounted, the test does not simply add up days. The three multipliers add to one and a half, so someone who spends the same number of days in the United States every year crosses the 183-day figure from the third year on once that number reaches 122, which is barely four months and feels well short of half the year. A single long stay followed by two quiet years may not cross it at all. Both conditions in section 7701(b)(3)(A) have to hold at once: the 31-day gate is independent of the 183-day sum, so a person who spent almost the whole of the two prior years in the country but only a handful of days this year fails the test no matter how large the weighted total is.
Days that do not count. Section 7701(b)(7) removes three categories of presence outright. A person who regularly commutes to work or self-employment in the United States from a residence in Canada or Mexico is not treated as present on a commuting day. A person in transit between two points outside the United States who is physically present for less than 24 hours is not treated as present. A regular crew member of a foreign vessel engaged in transportation between the United States and a foreign country is not treated as present, unless they otherwise conduct a trade or business here that day. Section 7701(b)(3)(D) removes two more: days as an exempt individual, and days the person "was unable to leave the United States on such day because of a medical condition which arose while such individual was present in the United States." The IRS also notes that for this test the United States means the 50 states and the District of Columbia plus territorial waters and the adjacent seabed, and that the term "does not include U.S. territories or U.S. airspace."
Exempt individuals, and the limits that eventually end the exemption. Section 7701(b)(5) defines four categories: a foreign government-related individual, meaning someone temporarily present by reason of diplomatic or consular status or as a full-time employee of an international organization, and their immediate family; a teacher or trainee temporarily present on a J or Q visa; a student temporarily present on an F, J, M or Q visa; and a professional athlete temporarily present to compete in a charitable sports event meeting specific conditions. Each requires substantial compliance with the visa's requirements. The exemption is not permanent. A teacher or trainee cannot use it in the current year if they were exempt in any two of the six preceding calendar years, a count the statute raises from two to four for an individual all of whose compensation is described in section 872(b)(3). A student loses it after five calendar years unless they establish to the IRS's satisfaction that they do not intend to reside permanently in the United States and still meet the visa conditions.
Excluding days is a filing act, not an automatic one. Anyone excluding days as an exempt individual, or because of a medical condition, must file Form 8843, Statement for Exempt Individuals and Individuals With a Medical Condition, with their income tax return, or send it separately by the return due date if no return is required. The IRS is direct about the consequence of missing it: "If you do not timely file Form 8843, you cannot exclude the days", unless the person shows by clear and convincing evidence that they took reasonable actions to learn of the requirement and significant steps to comply. A student who quietly assumes the exemption applies and files nothing can find the days counted back in.
The closer-connection exception, and the trap inside it. Section 7701(b)(3)(B) lets an individual who meets the day count still be treated as a nonresident, on two conditions: they were present on fewer than 183 actual days in the current year, and they establish that for the year they had a tax home in a foreign country and a closer connection to that country than to the United States. The claim is made on Form 8840, Closer Connection Exception Statement for Aliens. Section 7701(b)(3)(C) then disqualifies the exception entirely if at any time during the year the individual "had an application for adjustment of status pending" or "took other steps to apply for status as a lawful permanent resident of the United States." Starting a green card application therefore closes the escape hatch for that whole year, including retroactively for months already elapsed.
This is not the 330-day test, and the two get confused constantly. Both count days abroad or at home, both appear in expatriate tax planning, and they answer opposite questions. The substantial presence test in section 7701(b)(3) asks whether a non-citizen becomes a US tax resident by spending time in the United States. The physical presence test in section 911(d)(1)(B) asks whether a US citizen or resident already abroad qualifies for the foreign earned income exclusion, and requires 330 full days in a foreign country during any 12 consecutive months. One is about days in; the other is about days out. One uses a three-year weighted formula on a calendar year; the other uses a flat count over a flexible 12-month window. Nothing carries over between them.
A treaty can override the outcome. Where an individual is a resident of both countries under domestic law, most US income tax treaties contain a tie-breaker that assigns residence to one of them. A person who meets the substantial presence test but is treated as a resident of the treaty partner under the tie-breaker can be taxed as a nonresident alien, with a disclosed treaty position on the return. That is a different mechanism from the closer-connection exception, and it is available in cases the exception is not.