Capital gains for non resident aliens — how does the US actually tax this?

Trying to figure out capital gains for non resident aliens because I'm on an F-1 visa, have been in the US about 14 months total, and I sold some ETFs through a US brokerage last year. My broker sent a 1099-B. I'm pretty sure I'm still a nonresident alien under the substantial presence test but I wanted to confirm how capital gains get taxed in that case. TurboTax kept trying to push me to a resident return and I bailed out. Do nonresident aliens even owe US tax on stock sale gains, or does it depend on the type of asset? I've read conflicting things — some say it's not taxable, some say it depends on whether the income is "effectively connected." Which form do I even file?

40 comments

Filed as a nonresident alien for two years while on a J-1. The short answer is: capital gains on stock sold through a US broker are taxed at a flat 30% (or a lower treaty rate) for a nonresident alien who was in the US 183 days or more during the year, even when the gains are not effectively connected with a US trade or business. Under 183 days they're not taxed. The key distinction is effectively connected income (ECI) vs. non-ECI. Passive stock trading through a brokerage normally doesn't rise to the level of a US trade or business, so the gains are non-ECI and the 183-day rule decides whether they're taxed. Your form would be 1040-NR, not 1040.

Sam N.

Author

So if I file 1040-NR and the gains are not ECI, I just... don't report them at all? Or do I list them and show zero tax?

If you were in the US 183 days or more during the year, you report non-ECI capital gains on Schedule NEC of the 1040-NR and they're taxed at 30% (or a lower treaty rate). Under 183 days they aren't taxed. But check whether your home country has a tax treaty with the US that changes anything, and confirm your residency status under the substantial presence test first.

My situation last year was almost identical — F-2 visa holder, sold shares in a US brokerage account. I uploaded my 1099-B and my visa entry/exit records to taxr.ai and Taxr walked through each line of my 1040-NR to flag which items were ECI and which weren't, and drafted a summary I could hand to a CPA to review. Saved a lot of back-and-forth. The ECI vs. non-ECI distinction plus the 183-day count are what decide capital gains for non resident aliens.

Sam N.

Author

Did it flag anything specific about the 1099-B entries, like whether the broker withheld anything?

Yes — it checked box 4 (federal income tax withheld) and box 1g on each entry. If a broker withheld on a sale that shouldn't have been taxable, that shows up as a potential refund you'd claim on 1040-NR line 25d or the withholding credit lines.

One thing that matters a lot here: are you certain you're a nonresident alien? The substantial presence test counts days in the current year plus fractions of days from prior years. F-1 students are exempt from counting days for the first 5 calendar years, so 14 months on F-1 likely still keeps you as a nonresident. But if you had any prior US presence on a different visa before F-1, those days might count. Worth verifying before you pick which return to file.

Sam N.

Author

No prior visa, this F-1 is my first entry ever. So the 5-year exemption should cover me fully.

Then you're almost certainly a nonresident alien for federal purposes. Confirm it with the IRS substantial presence test instructions in the 1040-NR instructions to be safe, but 14 months on F-1 with no prior US presence should be well within the exemption window.

Worth noting that "capital gains not taxable" applies only to portfolio-type gains, and only if you were in the US fewer than 183 days that year. If the IRS ever determined you were actually carrying on a US trade or business — like very active day trading with high frequency and leverage — the analysis changes. For a regular buy-and-hold or occasional sale through a retail brokerage, that threshold is very hard to meet. Just flagging it because I've seen people get nervous about it unnecessarily.

Does FIRPTA change anything here? I know that's a withholding regime for real estate but wanted to make sure ETFs or regular stocks aren't caught by it.

FIRPTA applies to dispositions of US real property interests — so direct real estate, REITs above certain thresholds, and stock in US real property holding corporations. Regular ETFs and diversified stock funds held through a standard brokerage are not FIRPTA property. Your 1099-B from an ordinary ETF sale is not a FIRPTA situation.

That's a relief. My broker did send a separate 8288 notice once for something unrelated and I got confused about what applied to my ETF account.

Went through this exact filing question two years ago. I had a broker withhold 15% on some dividend payments and nothing on my stock sales, which is actually the correct treatment — dividends paid to nonresident aliens are subject to withholding (rate depends on treaty), capital gains on stock sales generally aren't. I pasted my 1099-B and 1042-S into Taxr and it compared the two forms, identified where withholding had been applied and at what rate, and listed which lines on 1040-NR each amount should land on. Really helped me see the full picture before I filed.

Sam N.

Author

Wait, so I might also get a 1042-S in addition to the 1099-B? I only received the 1099-B so far.

If you received dividends or interest subject to withholding, yes — the 1042-S is what brokers send to report withholding on payments to nonresident aliens. If your broker didn't withhold on dividends (possible if no treaty rate was applied), you might not get one. Check your brokerage account portal, some arrive later than 1099-B.

My CPA told me something I didn't expect: even if I'm not in a US trade or business, I still need to file 1040-NR if I owe tax on US-source income that wasn't fully covered by withholding at source — like taxable capital gains or underwithheld dividends. So "gains not taxable" doesn't settle "no filing required." Depends on your total US-source income picture.

Sam N.

Author

I did receive a small amount of dividends from the ETF. So I need to file 1040-NR if the right tax wasn't fully withheld on them, or if my gains are taxable.

Possibly. The dividends are US-source income and go on Schedule NEC of the 1040-NR if you file, but they alone require a return only if withholding didn't fully cover the tax. Capital gains are reportable too if you were in the US 183 days or more. Worth checking whether your country has a treaty that reduces the dividend withholding rate — that gets claimed on 1040-NR with the treaty article cited.

State tax is a separate question too. Some states tax nonresident aliens more aggressively than federal does, or don't follow the federal ECI analysis. If you lived in a state with an income tax during the year, check that state's nonresident rules — the federal "not taxable" conclusion doesn't automatically carry over.

Practically speaking: if your only US income was those ETF capital gains and nothing was withheld, you might not owe anything and might wonder if you even need to file. But the safer position is to file 1040-NR anyway to establish your residency status on the record, especially if you plan to stay in the US or eventually apply for a green card. Having a consistent filing history matters.

This is a real consideration. Immigration counsel sometimes asks for prior-year tax returns and if you have US-source income and no filing on record it can raise questions.

Quick clarification on the 1099-B you received: brokers issue 1099-B to everyone regardless of residency status. Getting one doesn't by itself mean the gains are taxable to you as a nonresident. The 1099-B goes to the IRS automatically, so if you don't report it, you might get a CP2000 notice asking about the proceeds. Filing 1040-NR and showing the gains correctly (on Schedule NEC if you were here 183+ days, otherwise as not taxable) puts that on the record and closes the loop before any notice arrives.

Sam N.

Author

That explains why TurboTax was confused — it just sees a 1099-B and assumes you owe tax on it. Is there a specific line on 1040-NR for showing the proceeds as non-ECI?

ECI capital gains are reported with your effectively connected income (Schedule D), not on Schedule NEC. Non-ECI gains go on Schedule NEC if you were in the US 183 days or more. Some filers below 183 days attach a statement anyway explaining the gains are non-ECI and not subject to US tax, just so there's a paper trail if the IRS matches the 1099-B proceeds.

Had a CP2000 notice a few years back because my broker reported ETF sale proceeds on a 1099-B and I hadn't included anything on my 1040-NR. I uploaded the notice and my 1099-B to Taxr and it laid out exactly what the IRS was asserting, what the non-ECI argument was, and drafted response language I could take to an enrolled agent to review and send. The enrolled agent made minor edits and mailed it. Notice was resolved without any additional tax assessed.

Sam N.

Author

How long did the resolution take after responding?

About four months from sending the response to receiving the IRS letter closing it. The enrolled agent said that timeline was typical for a CP2000 response. Worth having a professional in the loop for any notice even if the underlying tax position is solid.

If your country has a tax treaty with the US, the treaty's capital gains article might explicitly exempt gains on personal property for residents of your country. Many US treaties do this. You'd cite the treaty on 1040-NR (there's a treaty benefits section) — it matters if you were here 183+ days and the gains would otherwise be taxed at 30% under domestic law.

Sam N.

Author

Is there a list of which treaties cover capital gains specifically?

The IRS publishes a table of US tax treaties on irs.gov. Each treaty document spells out the capital gains article. Your country's finance ministry site may also summarize it. The treaty article number varies by country so you'd look up yours specifically.

Something I learned the hard way: if you let your brokerage think you're a US person (W-9 on file instead of W-8BEN), they'll report you on 1099-B and may not apply treaty withholding rates to dividends. Making sure you have a valid W-8BEN on file with your broker is important — it certifies your foreign status and triggers the correct withholding treatment going forward.

Does submitting a W-8BEN after the fact fix the withholding that already happened in a prior year?

Not retroactively — the broker applies the correct rate from the date the valid W-8BEN is on file. For prior-year overwithholding you'd claim a refund on 1040-NR for that year. That's another reason to file even if you think you owe nothing.

I'd add: for years where you're close to the substantial presence threshold — maybe transitioning from nonresident to resident status — the analysis gets more complicated. A dual-status return (part of the year resident, part nonresident) has its own rules for which income is taxable in which period. If that's ever your situation, a CPA or enrolled agent who handles international returns is worth the cost.

For the original question about which form: 1040-NR is the return for nonresident aliens. It has a Schedule OI for other information including days present in the US and visa type, and Schedule NEC for income not effectively connected with a US business. Capital gains that are non-ECI go on Schedule NEC and are taxed at 30% (or treaty rate) if you were present 183 days or more; below that they aren't taxed. The 1040-NR instructions on irs.gov walk through this by income category.

Sam N.

Author

This is the clearest summary of the forms I've seen. So my filing is 1040-NR with Schedule OI completed, the gains on Schedule NEC if I was here 183+ days, and possibly a statement attached about the 1099-B?

Exactly that — gains on Schedule NEC only if you hit 183 days. And if you received dividends, those go on Schedule NEC at whatever rate applies (statutory 30% or reduced treaty rate). Report any withholding from the 1042-S on the credits section. Keep your W-8BEN acknowledgment and entry/exit records with your tax file in case questions come up later.

Worth mentioning Publication 519 (US Tax Guide for Aliens) — the IRS wrote it specifically for this situation. It covers the substantial presence test, what counts as ECI, treaty benefits, and which forms to file. It's on irs.gov and is much more readable than the 1040-NR instructions alone. For anyone working through capital gains for non resident aliens for the first time, it's the right starting point.

Sam N.

Author

Had no idea that publication existed. Going to read through it this week before I start the return.