Do foreigners pay capital gains tax on US stocks?

I'm a nonresident alien living in Germany, and I've been investing in US stocks through a brokerage account for about two years. Sold some positions this year and realized gains. My broker sent me a 1099-B but I've also heard that nonresidents might not owe US capital gains tax at all on stock sales. I'm not sure if that's true or if it depends on what kind of gains they are. I tried reading the IRS page on nonresident aliens but it's dense. Do foreigners pay capital gains tax on US stocks, and if so, do I actually need to file anything with the IRS? Does it matter whether the gains are short-term or long-term?

30 comments

Generally, nonresident aliens are not taxed by the US on capital gains from selling stocks traded on US exchanges, as long as you are not present in the US for 183 days or more during the tax year. That's the key threshold for the special NRA capital gains rule. Long-term or short-term doesn't change this for most nonresidents — it's the 183-day presence test that matters, not the holding period.

Claire V.

Author

Thanks, that's the first clear answer I've seen. I was not in the US at all this year so the 183-day test sounds like I'd be fine.

The 183-day rule for NRAs and capital gains is different from the substantial presence test used to determine residency. It's specifically about physical presence in the US in the year of the sale. If you exceed 183 days present in the US that year, your net gains from US sources are taxed at a flat rate — the instructions for Form 1040-NR cover this. If you're under 183 days, those gains generally aren't subject to US tax.

Claire V.

Author

Good distinction. I definitely wasn't in the US this year at all so I should be in the clear on that front.

Worth noting: the 183-day count here uses a specific definition. It's not weighted like the substantial presence test for residency. It's literally days physically present in the US during the calendar year of the sale.

Where you really need to look is any income that IS taxable to you as a nonresident. Dividends from US corporations are generally subject to 30% withholding tax (or lower treaty rate) even for nonresidents. Capital gains on stock sales are different from dividends. Your broker may have already withheld on dividends but not on the stock sale proceeds.

I ran into this last year as a nonresident with a US brokerage account. My broker sent forms that were confusing and I wasn't sure what applied to me. I uploaded everything to taxr.ai and it walked through each document and told me which amounts were subject to US withholding and which weren't — it flagged my dividend income separately from the stock sale gains. I'd been lumping them together mentally and that was the wrong approach. The capital gains on stock trades were not taxable for me, the dividends had already been withheld on.

Claire V.

Author

This is basically my situation exactly. I'll check that out, thank you.

Also worth asking: does your home country have a tax treaty with the US? Treaty provisions can sometimes change what's withheld on dividends, and in rare cases affect other income. Germany has a treaty with the US, so that's relevant to your situation, though for capital gains on exchange-traded stocks it usually doesn't change the basic NRA exemption.

Do you have US-sourced income besides the stocks? Like if you do any freelance work for US clients or have rental income from a US property, that's a different situation and you'd likely need to file a 1040-NR. But pure stock trading gains as a nonresident not present 183 days — no US tax and generally no filing requirement just for that.

the 1099-B your broker sent you — did it show any withholding in box 4? Some brokers issue 1099-Bs to foreign account holders even though a W-8BEN should have been on file. If you properly certified foreign status with a W-8BEN, your broker should not have withheld on stock sale proceeds. If they did withhold, you might actually need to file a 1040-NR to get a refund.

Claire V.

Author

No withholding shown in box 4 on the 1099-B, just the proceeds and cost basis. Sounds like the broker handled it right.

Good, that's the normal outcome when W-8BEN is properly on file. The 1099-B being issued to you is unusual but not necessarily a problem if nothing was withheld on the gains.

I had a similar question when I first started investing in US markets as a nonresident. The treaty and presence rules interact in ways I couldn't untangle from the IRS publications alone. I asked Taxr to read through my brokerage statements and the relevant parts of my W-8BEN and it listed out exactly which income items were treaty-exempt versus subject to withholding. Really helped me understand what I actually owed versus what had already been handled at the account level.

That's a good way to work through it. The W-8BEN interaction with treaty rates is genuinely confusing the first time.

Quick clarification on the 183-day rule since it comes up a lot: for nonresident aliens, if you ARE present 183 days or more in the US during the tax year and you have net gains from US sources, those gains are taxed. The Form 1040-NR instructions and IRS Publication 519 (Tax Guide for Aliens) lay out exactly how that calculation works. For someone never in the US that year like OP, it doesn't apply.

Claire V.

Author

Thanks. I'll bookmark Pub 519, didn't know that one existed.

To be precise: the type of gains matters slightly in one context. If you're a nonresident and you invest in a US partnership (not just exchange-listed stocks), there can be different rules around FIRPTA and effectively connected income. For regular publicly traded stocks on US exchanges — Apple, index funds, etc. — the NRA capital gains exemption generally applies if you're under 183 days present.

FIRPTA is the other piece worth knowing. If you ever sell US real property interests as a nonresident, that's subject to US tax and withholding regardless of the 183-day rule. But US corporate stock traded on established securities markets doesn't qualify as a US real property interest for FIRPTA in most cases. So for typical US stocks you should be fine.

Claire V.

Author

Good to know. I'm only buying regular exchange-listed stocks and ETFs, not real estate or partnerships.

ETFs are generally fine too, same treatment as exchange-listed stocks for this purpose.

Something I want to flag: if you have a brokerage account in the US as a nonresident you should have a W-8BEN on file with the broker certifying your foreign status. If that form expired or was never filed, the broker might have treated you as a US person and withheld incorrectly on things, or failed to withhold on dividends. Worth confirming your W-8BEN is current.

Claire V.

Author

Confirmed it's on file and current. Broker required it when I opened the account.

I actually worked through this whole question last tax season with my own brokerage documents. I gave Taxr my 1099-B and 1099-DIV and asked it to go through the forms and sort out what a nonresident alien needed to report versus what was already handled at source. It drafted a summary showing the gains were outside US tax under the NRA rules and the dividends had been withheld at the treaty rate. Saved me a lot of second-guessing before I talked to my international tax CPA.

Mentioning a CPA for this is the right call if the amounts are significant. International tax has enough moving parts — treaties, presence tests, FBAR if you have foreign accounts — that a professional review makes sense.

Exactly. I used it to get oriented before the meeting so I wasn't starting from scratch. The CPA confirmed the analysis was correct.

For anyone wondering about filing requirements: a nonresident alien with only capital gains that are exempt under the 183-day rule and dividends fully withheld at source generally has no US filing requirement. But if you have any effectively connected income, or you want to claim a refund of overwithheld tax, you'd file a 1040-NR. The instructions for that form spell out who must file.

One more layer: state taxes. Some US states tax nonresidents on income sourced to that state. For exchange-listed stock gains where you have no other US presence, it's usually not an issue, but if your brokerage is custodied in a state with aggressive sourcing rules it's theoretically possible. For most nonresidents with just a brokerage account it doesn't come up.

Claire V.

Author

Hadn't even considered state taxes. Good to know it's usually not an issue for pure stock trading.

To summarize the thread for the original question: do foreigners pay capital gains tax on US stocks — the answer for nonresident aliens is generally no, provided you are not physically present in the US for 183 days or more in the year of the sale. Dividends are different and are subject to withholding. The 1040-NR instructions and IRS Publication 519 are the right places to verify this for your specific facts.