Nonresident alien capital gains tax — what actually gets taxed in the US?

I'm on an F-1 visa, been in the US about 14 months total, and I sold some US-listed ETFs through a brokerage account I opened here. My 1042-S arrived showing withholding, and my broker also sent a 1099-B, which confused me because I thought nonresidents don't get those. I looked at the 1040-NR instructions but couldn't figure out which capital gains are actually taxable for a nonresident alien versus which ones are exempt. I know the substantial presence test matters but I'm still counting my exempt days as an F-1 student. Does nonresident alien capital gains tax work differently depending on the type of asset — like ETFs versus individual stocks versus real estate? I haven't filed yet and want to make sure I'm on the right form before I do anything.

38 comments

Are you certain you're a nonresident alien for tax purposes? F-1 students count exempt days differently and the substantial presence test can flip on you depending on how long you've been here before this visa. That changes everything — 1040 versus 1040-NR, and the whole capital gains treatment changes with it.

Isaac F.

Author

Pretty sure I'm still a nonresident. I've only been physically here 14 months total, all on F-1, and F-1 days are exempt from the substantial presence count for the first 5 calendar years. So I shouldn't hit the threshold yet.

That tracks if you're in your first 5 calendar years on F-1. Just wanted to confirm because I've seen people assume they're nonresident when they'd actually crossed the threshold from a prior visa. Sounds like 1040-NR is the right form for you then.

What country are you from? The US has tax treaties with a lot of countries that change the nonresident alien capital gains tax picture completely — some treaties exempt certain gains that would otherwise be taxable. The 1040-NR instructions alone won't tell you about treaty positions; you'd need to check your country's specific treaty.

Isaac F.

Author

I'd rather not say the specific country but it's one with a treaty. How do I actually claim a treaty benefit on the 1040-NR if it applies?

You'd attach a Form 8833 to claim a treaty-based return position if the treaty exempts or reduces the gain. The 1040-NR has a line for treaty-exempt income too. The instructions for Form 8833 describe when you're required to file it versus when it's optional.

The basic rule for nonresident alien capital gains tax on US-listed ETFs and stocks is that gains from selling those on a US exchange are NOT subject to US tax for a nonresident alien only if you were in the US fewer than 183 days during the tax year. If you were here 183 days or more (F-1 days count for this), your net US-source capital gains are taxed at a flat 30% (or treaty rate) on Schedule NEC. Dividends are a different story and get withheld at 30% (or treaty rate) on the 1042-S. Real estate is completely different because of FIRPTA. I had a similar situation last year — dual-status year, broker sent both a 1042-S and a 1099-B and I had no idea how they fit together. I uploaded both forms to taxr.ai and it mapped out which income belonged on which section of my return and flagged that the ETF gains weren't taxable in my nonresident period. Saved me from reporting gains I didn't owe tax on.

Isaac F.

Author

This is really helpful. So the 1099-B for ETF sales might just be the broker covering themselves but I don't necessarily owe tax on those gains? I should still report them somewhere on 1040-NR or just not include them?

If you were in the US 183 days or more during the year, you'd include gains from selling US-listed securities on your 1040-NR (Schedule NEC, 30% or treaty rate) even when they're not effectively connected. If you were here fewer than 183 days and no treaty issue changes that, you generally wouldn't include them. But verify this against your specific facts — if the ETF holds real property interests, FIRPTA could apply. The 1040-NR instructions and IRS Publication 519 cover this directly.

Does your brokerage know you're a nonresident? Because if you gave them a W-9 instead of a W-8BEN when you opened the account, they'd treat you as a US person and that's why you're getting a 1099-B instead of only a 1042-S. That status mismatch can cause withholding headaches.

Isaac F.

Author

I think I filled out a W-8BEN but I'm not 100% sure — I did it online when I opened the account. Would I be able to check with the broker what they have on file?

Yes, call or message them and ask what taxpayer classification they have for your account. If they have you as a US person you can submit a corrected W-8BEN going forward. For this year's return you'd need to sort out which forms are accurate.

FIRPTA is the one that actually catches people off guard. If the ETF you sold is a US Real Property Holding Corporation or a REIT, the gains could be subject to withholding and taxation even for a nonresident. Regular broad-market equity ETFs usually don't trigger this but it's worth checking the fund prospectus.

Isaac F.

Author

Mine are broad index ETFs, not REITs. So I should be okay on the FIRPTA side?

Probably yes for broad equity index funds, but confirm the ETF isn't classified as a USRPHC. The fund company's website or the prospectus will say. It's a quick check and worth doing before you finalize the return.

One thing that helped me get the 1042-S right was uploading it to Taxr — I had dividend withholding and I wasn't sure whether the amount in box 10 was the right treaty rate or if the withholding agent had used the default 30%. Taxr read the form, compared the income code and exemption code against what my treaty rate should produce, and drafted a note explaining the discrepancy I could take to my broker. For the original question: nonresident alien capital gains tax on portfolio gains from US securities is not imposed at the federal level if you were here fewer than 183 days that year, but at 183 days or more (student days count) net gains are taxed at 30% or the treaty rate. The dividend and interest withholding on those same securities is real either way and shows on the 1042-S.

Isaac F.

Author

Did you end up getting the over-withheld amount back? I might have over-withholding on dividends too based on what the 1042-S shows.

Yes — you claim the credit for taxes withheld on the 1040-NR and if withholding exceeded your liability you get a refund. The 1040-NR has a line for the 1042-S withholding credit. Just make sure the income and withholding amounts match exactly what the 1042-S shows.

Is this your first year filing a 1040-NR? The form itself is not too bad once you understand it's structured differently from the 1040. Schedule NEC is where portfolio income that isn't effectively connected goes — dividends, certain interest — and it's taxed at a flat rate. Capital gains from US securities sales also go there at 30% if you were in the US 183 days or more during the year; only below 183 days do they generally not appear at all.

Isaac F.

Author

Yes first time. I didn't realize gains only stay off the return if I was here fewer than 183 days that year. I'll need to count my days before assuming that makes things simpler.

What about state taxes? Some states don't follow the federal nonresident alien exemption on capital gains. Depending on what state you're in this could change your filing obligation even if the federal side is clean.

Isaac F.

Author

I'm in a state with its own income tax. I hadn't even started thinking about the state return. Do most states follow the federal 1040-NR treatment for nonresident aliens?

No uniform rule — each state has its own rules. Some conform to the federal nonresident alien treatment, some don't. You'd need to look at your specific state's nonresident individual income tax rules. A lot of state tax agencies have guidance for nonresident aliens or international students specifically.

Crypto ETFs would be their own wrinkle here, so bookmark the IRS digital assets page too if any of yours are crypto ETFs. The reporting rules for crypto gains are different from equity ETFs — the 2025 Form 8949 has new boxes G through L specifically for digital asset transactions. For a nonresident the sourcing question on crypto gains is also less settled than it is for regular securities.

To confirm the sourcing rule that's been mentioned: gain from selling stocks or ETFs on a US exchange is generally untaxed for a nonresident alien under the US tax code, but if you're present in the US 183 days or more during the tax year (F-1 days count), net US-source capital gains are taxed at 30% or the treaty rate. It is not effectively connected income unless you're a trader with a US office and the gains are attributable to that office. Publication 519 (US Tax Guide for Aliens) covers the sourcing rules in detail.

Does that mean a nonresident alien could have a huge gain from selling US-listed stocks and owe zero federal tax on it?

Only if they were in the US fewer than 183 days that year — at 183 days or more, net capital gains are taxed at 30% (or treaty rate) even for a nonresident. Below that, the taxation kicks in on US-source fixed or determinable income like dividends, not on securities gains. It's one of the more counterintuitive parts of the nonresident alien capital gains tax rules.

How long ago did you sell? I want to make sure you're within the filing deadline for the 1040-NR. The due date turns on whether you had wages subject to withholding (April 15) or not (June 15) — the 1040-NR instructions spell out the specific due dates by situation.

Isaac F.

Author

Sold earlier this year, so I'm still within the normal filing window. Good reminder to check the 1040-NR instructions for the exact date though since I wasn't sure if it matched the regular April deadline.

Real estate is worth flagging separately even if it doesn't apply here. FIRPTA withholding on property sales by nonresident aliens is a whole different regime — 15% withholding at closing, Form 8288 filed by the buyer, Form 8288-A sent to the seller. Completely different from portfolio securities. Just wanted to make sure nobody reading this thread conflates the two.

Are you using a tax software that actually supports the 1040-NR? Most of the mainstream consumer software doesn't — TurboTax doesn't include it in standard packages and several others don't either. There are specialized platforms for international students or you can file on paper.

Isaac F.

Author

I've been looking at the paper version honestly. The specialized software options look expensive. Is paper filing for 1040-NR straightforward?

Paper works, it just takes longer to process. Make sure you attach the 1042-S, any Form 8833 if you're claiming a treaty position, and that all the withholding amounts tie exactly to what the forms show. Mismatches are a common reason for IRS correspondence on 1040-NR returns.

Has anyone here dealt with a dual-status return — part of the year nonresident, part resident? That situation is more complex because you'd file a 1040 with a 1040-NR attached as a statement for the nonresident portion, and the capital gains treatment differs by period. Doesn't sound like OP's situation but it comes up a lot with F-1 students who changed status mid-year.

Worth flagging — if someone's first year as a resident alien overlaps with an F-1 period, the dual-status rules apply and a first-year choice election might also be available. That's a situation where a CPA or enrolled agent familiar with international returns is worth the cost.

Going back to the original confusion about the 1099-B: even though the gains aren't taxable for a nonresident alien who was here fewer than 183 days that year, the broker may still be required to issue it depending on how they classified your account. Getting a form doesn't automatically mean you owe tax on what it reports. Your obligation is determined by your actual tax status, not by what form arrived in the mail.

To summarize where the thread landed: for a nonresident alien on F-1, gains from selling US-listed ETFs and stocks are not subject to US federal tax if you were here fewer than 183 days that year, but at 183 days or more they're taxed at 30% (or treaty rate) on Schedule NEC. Dividends from those holdings are US-source, subject to 30% withholding (or treaty rate), and show on the 1042-S. Real estate gains are a separate FIRPTA question. File 1040-NR, claim withholding credit for over-withheld amounts, attach Form 8833 if you're using a treaty position, and check your state separately.

Isaac F.

Author

This thread answered everything I was stuck on. Filing 1040-NR with the 1042-S withholding credit, counting my days to see if I hit 183 and must report the ETF gains, and separately looking into the state return and treaty question. Really appreciate everyone weighing in.