The substantial presence test for F-1 students
Days you spend in the US as a student on an F, J, M or Q visa are not counted for the substantial presence test while you are an "exempt individual", but that status ends once you have been exempt for any part of five calendar years, unless the IRS accepts that you do not intend to reside permanently in the US. A partial year counts as a whole one, so a student who arrived in August 2021 has used 2021 to 2025 and counts every US day from 1 January 2026. From then on the normal test applies: at least 31 days in the year and 183 weighted days, counting all of this year's days, one third of last year's and one sixth of the year before. Each year you exclude days as a student you must file Form 8843.
Check it with the free tool
Who is an exempt student
For the substantial presence test the IRS treats a student as anyone temporarily in the United States on an F, J, M or Q visa for the primary purpose of studying at an academic institution or vocational school, who substantially complies with the requirements of that visa. Substantial compliance means not engaging in activities that US immigration law prohibits and that could cost you your nonimmigrant status. The Treasury regulation adds that an unrevoked visa does not prove it: a student found to have accepted unauthorized employment, or to have carried a course load the IRS does not regard as full-time, is not substantially complying even if the visa still stands.
"Exempt individual" does not mean exempt from US tax. It only means that the days do not count toward the 183-day test. Income can still be taxable, and while the exemption lasts a student is generally a nonresident alien for US tax.
The exemption also covers immediate family: a spouse and unmarried children whose status is derived from and dependent on the student's, such as F-2 or J-2 dependants. Children qualify only while under 21, living regularly in the student's household and not members of another household. Attendants, servants and personal employees are not included.
Because exempt days are excluded entirely from the substantial presence test, they also drop out of the weighting in later years. A day that was exempt in 2024 adds nothing, not even one third of a day, when 2025 or 2026 is tested.
How the five calendar years are counted
Publication 519 and Treasury Regulation section 301.7701(b)-3 set the limit in the same words: you cannot exclude days as a student if you have been exempt as a teacher, trainee or student "for any part of more than five calendar years". Two details decide most cases.
- Any part of a year is a year. Arriving on 20 December uses up that whole calendar year. The count runs on calendar years, not on 12-month periods from your program start date.
- Earlier exempt status counts too. Years spent exempt as a J-1 teacher or trainee, or on an earlier F, J, M or Q stay, are added to the same total.
The limit is not absolute. A student who has passed five years can keep excluding days by establishing that they do not intend to reside permanently in the United States and that they have substantially complied with their visa. The IRS looks at whether you have kept a closer connection to a foreign country and whether you have taken affirmative steps toward lawful permanent residence. Form 8843 asks the question directly on line 12; answering yes requires an attached statement with enough facts to establish that you do not intend to reside permanently.
Teachers and trainees on J or Q visas have a shorter limit. They cannot be exempt in a year if they were exempt as a teacher, trainee or student for any part of 2 of the 6 preceding calendar years. Pub 519 allows an exception when a foreign employer paid all of their compensation in the current year and in each earlier year they were present as a teacher or trainee, and they were exempt for no more than 3 of those 6 years.
Form 8843 for every exempt year
Form 8843, Statement for Exempt Individuals and Individuals With a Medical Condition, is how a student tells the IRS which days to leave out. It is required for every year in which you exclude days as a student, whether or not you had any income.
- If you file Form 1040-NR, attach Form 8843 to it.
- If you have no return to file, mail Form 8843 on its own to the Department of the Treasury, Internal Revenue Service Center, Austin, TX 73301-0215, by the due date for Form 1040-NR. Pub 519 sets that date at April 15 if you had wages subject to withholding and June 15 if you did not; for 2025 those were April 15 and June 15, 2026.
- Students complete Parts I and III. Part I asks for your visa type and most recent entry date, which the instructions point you to the CBP I-94 website to confirm, and for any change of status during the year.
Missing the deadline has a real cost. The IRS substantial presence test page says that if you do not file Form 8843 on time you cannot exclude the days you were present as an exempt individual, unless you show by clear and convincing evidence that you took reasonable steps to learn about the filing requirement and significant steps to comply with it. Without the exclusion, a full academic year in the US can be enough on its own to meet the test.
Worked example: a student in their sixth year
A student enters the US in F-1 status in August 2021 and stays through a bachelor's degree. She is exempt for part of 2021 and all of 2022, 2023, 2024 and 2025: five calendar years. A sixth year of exemption in 2026 would take her past five, so unless she establishes that she does not intend to reside permanently, her 2026 days count.
She spends 1 to 7 January 2026 abroad, returns on 8 January and stays all year apart from a trip in August. The test for 2026 works out as follows.
- 2026 days, counted in full: present for 338 days (8 January to 31 December, less 20 days away).
- 2025 days at one third: 0, because every 2025 day was an exempt day.
- 2024 days at one sixth: 0, for the same reason.
Her total is 338 + 0 + 0 = 338, well over 183. She actually crosses the line on her 183rd day of 2026, 9 July, but because she was not a US resident in 2025 her residency starting date is the first day she was present in 2026, 8 January, not the day she reached 183. Any part of a day counts, so the day she flew back in is a full day.
The prior-year weighting starts to bite in 2027. Her 338 non-exempt days in 2026 contribute 338 / 3 = 112.67 weighted days, and 2025 still adds nothing. She needs only 71 days in 2027 (112.67 + 71 = 183.67) to meet the test again. Pub 519 adds that someone who was a resident for any part of the previous year and is a resident for any part of the current year is treated as a resident from the start of the current year.
OPT and STEM OPT
Optional Practical Training is employment authorized inside F-1 status, not a separate visa. Under 8 CFR 214.2(f)(10) a student may be authorized 12 months of practical training, and becomes eligible for another 12 months on moving to a higher educational level. Post-completion OPT must be completed within 14 months after the end of studies, and a student with a qualifying science, technology, engineering or mathematics degree can apply for a 24-month extension. The regulation states that during post-completion OPT, F-1 status is dependent upon employment: no more than 90 days of unemployment in total, or 150 days across OPT and a STEM extension combined.
For the tax count, the person on OPT is still an individual temporarily present on an F visa, so an OPT year is another calendar year on the same five-year clock as the classroom years. A student who arrived in 2021 and moved onto OPT in mid-2025 does not get a fresh allowance; 2026 is still the sixth year.
The switch also changes payroll. The IRS explains that nonresident alien students in F-1, J-1 or M-1 status are exempt from Social Security and Medicare tax on authorized work, which includes practical training employment on or off campus. That exemption does not apply once the student becomes a resident alien, or after a change to a status that is not exempt. Publication 519 adds that the taxes are withheld from a resident alien's pay even though the F, J, M or Q classification stays the same, which is why a student on OPT who meets the substantial presence test in the sixth year sees them appear on the payslip.
The closer connection exceptions and students
The general closer connection exception lets someone who meets the substantial presence test stay a nonresident if they were present in the US on fewer than 183 days in the current year, kept a tax home in a foreign country for the whole year, had a closer connection to that country than to the US, and had not applied for or taken steps toward a green card. It is claimed on Form 8840.
The IRS says most foreign students cannot use it, because of two of its requirements: not being physically present in the US on more than 182 days in the current year, and having a tax home outside the US. Pub 519 defines the tax home as the general area of your main place of business, employment or post of duty.
Students have a second, separate exception under IRC section 7701(b)(5)(D) and (E). It is available only to students, not to teachers, researchers or trainees, and all four conditions must be met:
- The student does not intend to reside permanently in the United States.
- The student has substantially complied with the immigration requirements of their student status.
- The student has not taken any steps in the US to change their nonimmigrant status toward lawful permanent residence.
- The student has a closer connection to a foreign country than to the US, judged by the factors in Treasury Regulation section 301.7701(b)-2(d)(1).
The burden of proof is on the student. The claim is made by attaching Form 8843 to Form 1040-NR, with the line 12 statement explaining why the student does not intend to stay permanently. On its closer connection page the IRS treats having filed Form I-485, I-130 or I-140 as an indication of intent to become a lawful permanent resident.
The dual-status year
The year a student first meets the test is usually a dual-status year: nonresident until the residency starting date and resident from that date to 31 December. The IRS taxes the two parts differently. For the resident part you are taxed on income from all sources, including income from outside the US received while resident. For the nonresident part you are taxed on income from US sources only.
A dual-status return has its own restrictions. You cannot take the standard deduction, though some deductions can be itemized, you cannot use the head of household tax table, and you cannot file a joint return unless you are married to a US citizen or resident and both of you choose to be treated as residents for the whole year. The form depends on your status on the last day of the year:
- Resident on 31 December: file Form 1040 marked "Dual-Status Return", with a statement, which can be Form 1040-NR marked "Dual-Status Statement", showing income for the nonresident part.
- Nonresident on 31 December: file Form 1040-NR marked "Dual-Status Return", with Form 1040 as the statement for the resident part.
Tax treaties can still matter. The IRS notes that treaty provisions generally apply only to the nonresident part of the year, with an exception for some students, apprentices, trainees, teachers, professors and researchers who become resident aliens, covered in chapter 9 of Pub 519.
Frequently asked questions
Do F-1 students count days for the substantial presence test?
Not while they are exempt individuals. Days as a student on an F, J, M or Q visa who substantially complies with the visa are excluded, generally for the first five calendar years, provided Form 8843 is filed. After that, every day in the US counts.
Does my arrival year count as a full year if I arrived in December?
Yes. The limit is being exempt "for any part of more than five calendar years", so a few days in December use up that calendar year.
Do I have to file Form 8843 if I had no US income?
Yes, if you are excluding days as a student. With no return to file, you mail Form 8843 by itself to the IRS in Austin, Texas, by the due date for Form 1040-NR, which is June 15 of the following year if you had no wages subject to withholding.
Do OPT and STEM OPT years count toward the five years?
Yes. OPT is employment inside F-1 status, so a year on OPT is another calendar year on the same five-year count. It does not restart the clock.
I changed from F-1 to H-1B during the year. Which days count?
Only days in F, J, M or Q status can be exempt student days. Days after the change of status count toward the test. Form 8843 asks for the date of the change on line 1b.
Can my F-2 spouse exclude their days too?
Yes, if their status is derived from and dependent on yours. A spouse and unmarried children under 21 who live in your household and are not members of another household are covered.
Is a J-1 researcher covered by the five-year student rule?
No. Teachers and trainees on J or Q visas lose the exemption if they were exempt for any part of 2 of the 6 preceding calendar years, and the closer connection exception reserved for students is not available to them.
Related rules
This rule is tracked in
Dwelltime
- Counts your days for this rule from the trips you record
- Shows the last safe day, or the days still needed, before you book
- Explains every counted day and every uncounted one
- Runs alongside your other visa, tax and residency rules
Sources
- IRS β Substantial presence test
- IRS β Exempt individual β who is a student
- IRS β Publication 519, U.S. Tax Guide for Aliens
- IRS β Form 8843 and instructions
- IRS β The closer connection exception to the substantial presence test for foreign students
- IRS β Closer connection exception to the substantial presence test
- IRS β Foreign student liability for Social Security and Medicare taxes
- IRS β Taxation of dual-status individuals
- eCFR β 26 CFR 301.7701(b)-3, Days of presence that are excluded
- eCFR β 8 CFR 214.2(f), F-1 students and practical training
For information only. This page is a plain-English summary of publicly available rules, not tax, legal or immigration advice. Rules change and depend on your personal circumstances β always confirm with the official sources above and a qualified professional before acting.