EADly's F-1 student taxes guide already summarizes the exemption and the refund claim. This post goes further for one question: Social Security and Medicare were taken from your OPT pay, so what do the IRS sources say about the exemption, how do you check whether you're still a nonresident alien, and what goes into each refund step?
Not tax advice. This article summarizes official IRS sources and federal law. It is not tax, legal or immigration advice, and it doesn't decide your tax residency. EADly is not a tax preparer and is not affiliated with the IRS, USCIS or DHS. For your own situation, use the IRS pages linked below or a qualified tax professional. Last checked October 22, 2026. Each source's own date is in the Sources list.
What the exemption says
Social Security and Medicare are the two taxes under the Federal Insurance Contributions Act, or FICA (IRS Topic 751).
The law. The tax code leaves out of "employment" any service "performed by a nonresident alien individual for the period he is temporarily present in the United States as a nonimmigrant under subparagraph (F), (J), (M), or (Q)" of the immigration law, "and which is performed to carry out the purpose specified" in that subparagraph (26 U.S.C. 3121(b)(19)).
The IRS. Nonresident alien F-1, J-1 and M-1 students "are exempt from Social Security Tax and Medicare Tax on wages paid to them for services performed within the U.S." Two conditions apply: "the services performed need to be allowed by USCIS for these nonimmigrant statuses, and such services are performed to carry out the purposes for which such visas were issued." The IRS lists three kinds of exempt employment (IRS, Foreign Student Liability for Social Security and Medicare Taxes):
- "On-campus student employment up to 20 hours a week (40 hrs. during summer vacations)."
- "Off-campus student employment allowed by United States Citizenship and Immigration Services (USCIS)."
- "Practical Training student employment on or off campus."
Pub. 519 says these services "are very limited and generally include only on-campus work, practical training, and economic hardship employment" (IRS Pub. 519 (2025), ch. 8). The employer's guide, Pub. 15, lists F-1 students as "Exempt if service is performed for purpose specified in section 101(a)(15)(F), (J), (M), or (Q) of Immigration and Nationality Act," and adds: "these taxes may apply if the employee becomes a resident alien" (IRS Pub. 15 (2026), section 15).
Flag: STEM OPT isn't named. The IRS pages say "practical training," and Pub. 519 refers to students "engaged in optional practical training." None of them names STEM OPT. In the immigration regulation, STEM OPT sits inside the "Practical training" paragraph as a "24-month extension of post-completion OPT" (8 CFR 214.2(f)(10)(ii)(C)). If your employer treats STEM OPT differently, ask it to explain, or ask a tax professional.
How to check whether FICA was withheld
- Pay stubs. Look for Social Security and Medicare deductions. The IRS notes that Social Security taxes are the "old-age, survivors, and disability insurance taxes" (IRS Topic 751).
- Form W-2. Box 4 is "Social security tax withheld" and box 6 is "Medicare tax withheld" (Form W-2 (2026)).
- The rates. The employee share is 6.2% for Social Security and 1.45% for Medicare (IRS Topic 751).
A fictional example. Mei earns $6,000 a month on OPT from June through December 2026, so $42,000 in wages. If her employer withheld FICA all seven months, her 2026 W-2 would show $2,604.00 in box 4 (6.2%) and $609.00 in box 6 (1.45%), $3,213.00 in total.
The separate 0.9% Additional Medicare Tax, withheld on wages over $200,000 (IRS Topic 751), works differently. Pub. 519 says: "Do not use Form 843 to request a refund of Additional Medicare Tax." It is claimed on Form 8959 with your income tax return (Pub. 519, ch. 8).
Are you still a nonresident alien? The 5-calendar-year count
The exemption is for nonresident aliens. "The exemption does not apply to F-1, J-1, or M-1 students who become resident aliens" (IRS). Pub. 519 says FICA "will be withheld from your pay for these services if you are considered a resident alien ... even though your nonimmigrant classification ('F,' 'J,' 'M,' or 'Q') remains the same" (Pub. 519, ch. 8).
For most F-1 students, residency turns on the substantial presence test and whether your days count. Students are "exempt individuals" whose days don't count, for a limited number of calendar years:
- The law: "For any calendar year after the 5th calendar year for which an individual was an exempt individual under clause (ii) or (iii) of subparagraph (A), such individual shall not be treated as an exempt individual" as a student, unless the person establishes "that such individual does not intend to permanently reside in the United States" and meets the visa-compliance requirement (26 U.S.C. 7701(b)(5)(E)(ii)). Clause (ii) covers teachers and trainees; clause (iii) covers students.
- The IRS: you are not an exempt individual as a student "if you have been exempt as a teacher, trainee, student, Exchange Visitor, or Cultural Exchange Visitor on an 'F,' 'J,' 'M,' or 'Q' visa for any part of more than 5 calendar years," unless you show you don't intend to reside permanently and have substantially complied with your status (IRS, Exempt Individual: Who Is a Student).
Two things follow from the wording. Calendar years count, not 12-month periods. And "any part" of a year counts as a year.
Fictional example, continued. Mei first arrived on F-1 on August 15, 2022, and had no earlier U.S. student, teacher or trainee years.
| Calendar year | Exempt-individual year number | What the sources say |
|---|---|---|
| 2022 (from Aug. 15) | 1 | Any part of a calendar year counts |
| 2023 | 2 | |
| 2024 | 3 | |
| 2025 | 4 | |
| 2026 (OPT starts June 1) | 5 | Within the first 5 calendar years |
| 2027 | 6 | "after the 5th calendar year": generally not an exempt individual as a student, unless the exception applies |
In 2027 her days would count toward the substantial presence test. If she meets it, Pub. 519 says "your residency starting date is generally the first day you are present in the United States during that calendar year" (Pub. 519, ch. 1). The test itself, the closer connection exception for students and Form 8843 are in our tax guide. That guide also notes that IRS pages word the 5-year rule differently.
Other cases where the exemption doesn't apply
The IRS lists these limits (IRS):
- F-2, J-2 and M-2 spouses and children.
- "employment not allowed by USCIS or ... employment not closely connected to the purpose for which the visa was issued."
- Students "who change to another immigration status which is not exempt." The IRS list of exempt nonimmigrant classes includes F-1, J-1, M-1 and Q-1, and among H classes only certain H-2 and H-2A workers (IRS, Aliens Employed in the U.S.: Social Security Taxes). H-1B is not on that list. On the move to H-1B, see F-1 to H-1B: cap-gap and the grace period.
- Students who become resident aliens (above).
Two other rules can change the answer:
- The student FICA exception (IRC 3121(b)(10)) is separate and applies regardless of residency, but only to students working for the school where they are enrolled at least half-time. "Off-campus jobs or working for other employers do not qualify" (IRS).
- Totalization agreements between the United States and some countries "must be taken into account" (same page).
Flag: cap-gap. The IRS pages checked don't mention cap-gap. Under the immigration rules, cap-gap extends an eligible student's F-1 duration of status (8 CFR 214.2(f)(5)(vi)(A)). Ask your payroll team or a tax professional how they treat that period.
Self-employment tax is a different question. The IRS says "An NRA is not liable for the self-employment tax" (same IRS page). See self-employment on OPT.
Step 1: ask your employer to refund it
The IRS says: "If Social Security or Medicare taxes were withheld in error from pay that is not subject to these taxes, contact the employer who withheld the taxes for a refund" (IRS).
What the IRS tells employers (Pub. 15 (2026), section 13):
- "If you withheld more than the correct amount of income, social security, or Medicare tax from wages paid, repay or reimburse the employee the excess."
- The employer should keep "the employee's written receipt showing the date and amount of the repayment or record of reimbursement." Your employer may ask you to sign one.
- When an employer corrects Social Security and Medicare wages and taxes reported for a previous year, it "also need[s] to file Form W-2c."
Ask for a written statement. If you end up filing with the IRS, Pub. 519 asks for "A statement from your employer indicating the amount of the reimbursement your employer provided and the amount of the credit or refund your employer claimed or you authorized your employer to claim" (Pub. 519, ch. 8). It's easier to get while you're talking to payroll.
Step 2: if you can't get it all back, Form 843 with Form 8316
"If you are unable to get a full refund of the amount from your employer, file a claim for refund with the Internal Revenue Service on Form 843, Claim for Refund and Request for Abatement and Form 8316" (IRS).
Form 843
- Reason box. One box at the top reads: "Refund to employee of social security, Medicare, or RRTA tax withheld in error, but only if your employer will not adjust the overcollection" (Form 843, Rev. December 2024).
- One form per tax period. "Generally, you must file a separate Form 843 for each tax period" (Form 843 instructions).
- What the lines ask (same instructions): line 1, the tax period; line 2, the amount; line 3, the date of each payment; line 4, the type of tax; line 8, your reasons in detail, with your computation and supporting evidence.
- Your number. Enter your SSN, or your ITIN "whenever an SSN is requested" if you have an ITIN instead.
Form 8316
Form 8316 (Rev. January 2006) asks first: was the income "directly related to your course of studies as identified by the provisions of your entry visa"? "If you checked 'NO,' the taxes were correctly withheld and you are not entitled to a refund." If you checked "YES," "you must first try to get a refund of the Social Security taxes from your employer before filing a claim." Its numbered questions ask whether your employer paid any of it back, whether you authorized the employer to claim it, whether the employer claimed it, whether you claimed any of it against your federal income tax, and the employer's name and address. There is space to explain why you couldn't get a statement from your employer (Form 8316).
Sources differ on Form 8316. The IRS FICA page says to file Form 843 "and Form 8316." Pub. 519 lists Form 8316 as one way to show your employer won't refund, alongside an employer statement or your own statement. Our tax guide notes the same difference.
The attachments Pub. 519 lists
| Attachment | Pub. 519 wording |
|---|---|
| Form W-2 | "to prove the amount of social security and Medicare taxes withheld" |
| Your visa | "A copy of your visa" |
| Form I-94 | "(or other documentation showing your date of arrival or departure)" |
| Form I-20 | "If you have an F-1 or M-1 visa, attach a complete copy of your Form I-20" |
| Your EAD | "If you are engaged in optional practical training, attach Form I-766" |
| Employer statement | The statement above, or your own statement explaining why you are not attaching one from your employer, "or on Form 8316 claiming your employer will not issue the refund" |
| Part-year pay statements | "If you were exempt from social security and Medicare taxes for only part of the year, pay statements showing the tax paid during the period you were exempt" |
Source: Pub. 519 (2025), ch. 8, "Refund of Taxes Withheld in Error". How to get your I-94: I-94 guide.
Where to mail it
Pub. 519 says to send Form 843 with attachments to:
Department of the Treasury, Internal Revenue Service Center, Ogden, UT 84201-0038
The Form 843 instructions send nonresident aliens asking for this refund to "the address in Pub. 519" and tell them to follow its "specific instructions ... regarding the documents to be filed and the conditions under which the form can be filed" (Form 843 instructions).
How long you have to file
- The general rule. "Generally, you must file a claim for a credit or refund within 3 years from the date you filed your original return or 2 years from the date you paid the tax, whichever is later. If you do not file a claim within this period, you may no longer be entitled to a credit or refund" (Form 843 instructions). The law says the same in 26 U.S.C. 6511(a).
- A timing rule for these taxes. For taxes under chapter 21 of the tax code, where the Social Security and Medicare wage tax rules sit, a return for a period in a calendar year that is filed before April 15 of the next year "shall be considered filed on April 15 of such succeeding calendar year," and tax paid before then is "considered paid on April 15" of that year (26 U.S.C. 6513(c)).
The instructions state the rule for Form 843 claims in general, not for student FICA refunds specifically. This post doesn't calculate a deadline for you. Ask the IRS or a tax professional, and don't wait until the end of the period.
Putting it together: Mei's steps (fictional)
- Check. Her 2026 W-2 shows $2,604.00 in box 4 and $609.00 in box 6.
- Check her count. 2026 is her fifth exempt calendar year (table above). Whether she is a nonresident alien for 2026 depends on the IRS tests, not on this example.
- Ask payroll for a refund and for a written statement of what it repaid or claimed.
- If payroll refunds only part, file one Form 843 for tax year 2026 with Form 8316 and the attachments Pub. 519 lists, and mail it to the Ogden address.
- Plan for 2027. It is her sixth calendar year, so the exemption may no longer apply. The IRS pages and a tax professional can confirm.
Keeping the records in EADly
EADly is a private, local-first app for iPhone and Android:
- Tax-year facts (Free). U.S. day counts per calendar year from your I-94s and trips, your F-1 calendar years and IRS due dates, with up to two reminders a year. EADly shows this note with it: "Tax residency is separate from immigration status. This is arithmetic from your records, not tax advice."
- Document Vault. Keep your W-2, I-20, EAD and I-94 encrypted on your phone. EADly Free stores one file; EADly Plus removes the file-count limit.
- Tax-season readiness packet. Preview what's saved and what's missing (Free); one-share export is Plus.
What it doesn't do: EADly doesn't calculate FICA, decide your tax residency or whether wages are exempt, or file Form 843 or anything else with the IRS.
Get EADly on the App Store or Google Play. It's a free download.
Common questions
Do F-1 students on OPT pay Social Security and Medicare tax?
The IRS says nonresident alien F-1 students are exempt on wages for services USCIS allows that carry out the purpose of the visa, and it lists practical training as exempt employment. The exemption doesn't apply to students who become resident aliens.
Does the exemption cover STEM OPT?
The IRS pages say "practical training" and don't name STEM OPT. The immigration regulation places STEM OPT inside its practical training paragraph as an extension of post-completion OPT. Ask your employer or a tax professional if they treat it differently.
My employer withheld FICA by mistake. What do I do first?
The IRS says to contact the employer that withheld the taxes and ask for a refund. Pub. 15 tells employers to repay or reimburse the employee the excess.
What if my employer won't refund it?
The IRS says to file Form 843 and Form 8316 with supporting documents. Pub. 519 lists your W-2, visa, I-94, complete I-20, EAD for OPT, an employer statement or your own statement (or Form 8316), and pay statements if you were exempt for only part of the year.
Where do I mail Form 843 for a FICA refund?
Pub. 519 gives Department of the Treasury, Internal Revenue Service Center, Ogden, UT 84201-0038. The Form 843 instructions point nonresident aliens to that Pub. 519 address.
How long do I have to claim the refund?
The Form 843 instructions give the general rule: 3 years from filing the original return or 2 years from paying the tax, whichever is later. A separate law, 26 U.S.C. 6513(c), sets April 15 timing rules for these taxes. Ask the IRS or a tax professional how they apply to you.
When does the exemption stop?
It doesn't apply once you become a resident alien for tax purposes, or once you change to a status that isn't exempt. H-1B isn't on the IRS list of exempt classes. The law says a student generally stops being an exempt individual for any calendar year after the 5th, which can lead to residency under the substantial presence test.
Sources
All checked October 22, 2026. The date in brackets is the date each page showed.
- IRS, Foreign Student Liability for Social Security and Medicare Taxes: https://www.irs.gov/individuals/international-taxpayers/foreign-student-liability-for-social-security-and-medicare-taxes [last reviewed 08/18/2026; checked October 22, 2026]
- IRS, Aliens Employed in the U.S.: Social Security Taxes: https://www.irs.gov/individuals/international-taxpayers/aliens-employed-in-the-us-social-security-taxes [last reviewed 05/22/2026; checked October 22, 2026]
- IRS, Exempt Individual: Who Is a Student: https://www.irs.gov/individuals/international-taxpayers/exempt-individual-who-is-a-student [last reviewed 07/06/2026; checked October 22, 2026]
- IRS, Publication 519 (2025), U.S. Tax Guide for Aliens: https://www.irs.gov/pub/irs-pdf/p519.pdf [for 2025 returns; checked October 22, 2026]
- IRS, Publication 15 (2026), Employer's Tax Guide: https://www.irs.gov/pub/irs-pdf/p15.pdf [2026 edition; checked October 22, 2026]
- IRS, Topic No. 751, Social Security and Medicare Withholding Rates: https://www.irs.gov/taxtopics/tc751 [last reviewed 09/24/2026; checked October 22, 2026]
- IRS, Form W-2 (2026): https://www.irs.gov/pub/irs-pdf/fw2.pdf [2026 form; checked October 22, 2026]
- IRS, Form 843, Claim for Refund and Request for Abatement: https://www.irs.gov/pub/irs-pdf/f843.pdf [Rev. December 2024; checked October 22, 2026]
- IRS, Instructions for Form 843: https://www.irs.gov/pub/irs-pdf/i843.pdf [Rev. December 2024; checked October 22, 2026]
- IRS, About Form 843: https://www.irs.gov/forms-pubs/about-form-843 [last reviewed 07/01/2026; checked October 22, 2026]
- IRS, Form 8316: https://www.irs.gov/pub/irs-pdf/f8316.pdf [Rev. January 2006; checked October 22, 2026]
- 26 U.S.C. 3121, United States Code (2023 edition): https://www.govinfo.gov/content/pkg/USCODE-2023-title26/html/USCODE-2023-title26-subtitleC-chap21-subchapC-sec3121.htm [checked October 22, 2026]
- 26 U.S.C. 7701, United States Code (2023 edition): https://www.govinfo.gov/content/pkg/USCODE-2023-title26/html/USCODE-2023-title26-subtitleF-chap79-sec7701.htm [checked October 22, 2026]
- 26 U.S.C. 6511, United States Code (2023 edition): https://www.govinfo.gov/content/pkg/USCODE-2023-title26/html/USCODE-2023-title26-subtitleF-chap66-subchapB-sec6511.htm [checked October 22, 2026]
- 26 U.S.C. 6513, United States Code (2023 edition): https://www.govinfo.gov/content/pkg/USCODE-2023-title26/html/USCODE-2023-title26-subtitleF-chap66-subchapB-sec6513.htm [checked October 22, 2026]
- 8 CFR 214.2(f)(5)(vi) and (f)(10), eCFR as of Sept 14, 2026: https://www.ecfr.gov/on/2026-09-14/title-8/chapter-I/subchapter-B/part-214/subpart-A/section-214.2 [checked October 22, 2026; the quoted paragraphs read the same in the current eCFR]
This article summarizes official U.S. government sources and is not tax, legal or immigration advice. EADly is not a tax preparer or law firm and is not affiliated with the IRS, USCIS or DHS.