US tax on capital gains for foreigners: what actually applies to me?

Trying to figure out US tax on capital gains for foreigners and getting completely different answers depending on where I look. My situation: I'm a nonresident alien (NRA), live outside the US, and I sold shares in a US-listed ETF through a US brokerage account this year. The broker sent a 1099-B showing a long-term gain. My country has a tax treaty with the US. I've heard NRAs don't pay US capital gains tax on stock sales, but then I also read something about FIRPTA and ECI (effectively connected income) and now I'm not sure if any of that applies to me. I'm not running a US business. The shares are just publicly traded ETF shares. Do I owe US tax on this gain? Do I need to file a US return at all? Does the treaty change anything? I've been going round and round on this and would really like a straight answer on where to start.

35 comments

Form 1040-NR is the return for nonresident aliens if you're required to file one. Whether you're required depends on whether you have US-source income that is taxable. For most NRAs, capital gains on US publicly traded securities are NOT subject to US tax unless you were present in the US for 183 days or more during the tax year under a specific NRA rule. That's different from the substantial presence test for residency. Check Publication 519 (US Tax Guide for Aliens) for the full breakdown of that 183-day rule.

Nina C.

Author

Form 1040-NR — okay that's the starting point. And I was not in the US at all this year so the 183-day threshold isn't an issue. Does that mean I owe nothing and don't need to file?

The 183-day test for NRA capital gains is narrower than you think. It only applies if you were present in the US for 183 days or more during the tax year. If so, your net US-source capital gains (gains exceeding losses) are taxed at 30% or a lower treaty rate. There's no separate tax home condition. If you live abroad full-time and had no US presence, you don't meet it and likely owe no US tax on those gains.

FIRPTA is a separate thing — it applies to dispositions of US real property interests, not publicly traded stock. An ETF holding US stocks is not a US real property interest unless it qualifies as a USRPHC (US Real Property Holding Corporation), and even then there's a publicly traded exception. So for a standard diversified US-listed ETF you can almost certainly set FIRPTA aside entirely.

Nina C.

Author

That's a relief. The FIRPTA stuff was scaring me and it sounded like it could apply to anything US-related.

Publicly traded exception is the key phrase. If the ETF shares are regularly traded on an established securities market, an NRA who held 5% or less of the class of shares can treat the sale as not subject to FIRPTA. That threshold matters, so look at your holding relative to the total shares outstanding.

Publication 519 is the main IRS document for this — it covers exactly when NRA capital gains are taxable, the 183-day rule, and how treaties interact with the domestic rules. I uploaded my brokerage statement and the relevant treaty article to taxr.ai and it walked through each line of my 1040-NR to show which entries were needed and which I could leave blank given my residency situation. That saved me from filing unnecessarily. The domestic NRA exemption and the treaty exemption sometimes overlap, so knowing which one you're relying on matters for how you fill out the form.

Nina C.

Author

Really useful. I'll pull up Publication 519. Did Taxr flag anything specific about the treaty interaction?

It flagged that the treaty exemption requires you to claim it properly on the 1040-NR — specifically on Schedule OI (Other Information) and in some cases with Form 8833 (Treaty-Based Return Position Disclosure). If you just rely on the domestic NRA rule and don't need a treaty position, Form 8833 isn't required. That distinction matters if you're deciding whether to file at all.

ECI (effectively connected income) is the other category that could make gains taxable. If you're running a US trade or business and the gains are connected to it, they become ECI and are taxable at regular rates on 1040-NR. But passive portfolio investing — buying and selling publicly traded ETF shares through a brokerage account — is not a US trade or business under the general rule. So ECI shouldn't apply here.

Nina C.

Author

ECI was the term that confused me most. Good to know passive investing doesn't trigger it.

Schedule D and Form 8949 still appear on the 1040-NR if you have reportable transactions, even if the tax ends up being zero. Some filers skip the return entirely because they think no tax means no filing obligation, but if the broker withheld anything or if there's any US-source income involved, you may need to file to claim a refund.

Nina C.

Author

Schedule D on the 1040-NR — hadn't thought about that. The broker didn't withhold anything on the ETF sale. Does that change whether I need to file?

If there was no withholding and no other US-source income and the gain falls under the NRA exemption, you generally don't have a filing obligation. But check whether you received any dividends from the ETF during the year — those are taxed differently and brokers typically do withhold on them. That could create a separate reason to file.

The treaty question is worth taking seriously. The domestic NRA rule already exempts most portfolio gains, but some treaties go further and explicitly exempt dividend income or reduce withholding rates. If your country has an article on capital gains or dividends in its treaty with the US, it's worth reading that article directly. The IRS treaty tables are on the IRS website. Knowing which rule you're using changes what you disclose.

Form 8833 (Treaty-Based Return Position Disclosure) is required when you take a treaty position that overrides or modifies a provision of the Internal Revenue Code, with some exceptions. I had a situation where my gain was already exempt under domestic NRA rules but I wanted to also note the treaty. Taxr read through my draft 1040-NR and the treaty article and told me exactly which fields on Schedule OI to complete and whether my situation crossed the threshold where Form 8833 was mandatory. Really helped me understand what I actually had to disclose versus what was optional.

Nina C.

Author

Form 8833 is the one I kept seeing mentioned and not understanding when it triggers. That clarifies it a lot.

Schedule OI is always filled out on the 1040-NR if you're claiming any treaty benefit. Form 8833 is the separate disclosure that's needed when the treaty position modifies what the Code would otherwise require. If the Code already exempts the gain, you're not modifying the Code with the treaty, so 8833 may not be required. And even when the treaty is doing the work by reducing withholding on dividends, that's a listed exception, so 8833 generally isn't required for that either.

Worth noting that the 1099-B the broker sent you is primarily for the IRS's information — brokers issue them to US persons and in some NRA cases. It doesn't by itself mean you owe tax. The key is your residency status and whether the gains are US-source income that's taxable to an NRA.

The holding period still matters even for NRAs because if gains were taxable (say, ECI situation), short-term and long-term are taxed differently. For the NRA domestic exemption, the 183-day test only applies to what are categorized as US-source capital gains. Long-term gains on US securities from an NRA not present in the US are the clearest case for exemption.

Nina C.

Author

Long-term is confirmed on my 1099-B. Good to know that's the cleaner case.

One thing that tripped me up in a similar situation was state taxes. Even if you owe nothing federally, some states that have their own income tax may assert a filing obligation if you have a US brokerage account with them. Probably not relevant if you have no US state connection, but worth confirming your brokerage isn't in a state that could argue nexus.

Nina C.

Author

State taxes hadn't crossed my mind at all. I'll check whether my brokerage is domiciled somewhere that has a state income tax.

Publication 901 (US Tax Treaties) is another IRS resource that lists each treaty country and summarizes the key articles. It's not as detailed as the treaty text itself but it's a fast way to check whether your country's treaty covers capital gains and what the rate or exemption looks like before you dig into the full treaty.

Schedule OI on Form 1040-NR asks specifically about treaty claims and your country of residence. When I had an NRA gain question I uploaded my 1040-NR draft to Taxr and it went through Schedule OI field by field, checking my answers against my residency documents and the treaty summary I pasted in. It also flagged that my ETF dividends were on a different line of the return than the capital gain — line 1 versus line 9 of Schedule NEC on the 1040-NR — so I wasn't mixing them up. Really useful for catching that kind of structural error before submitting.

Nina C.

Author

Line 1 versus line 9 on Schedule NEC — I definitely would have mixed those up. That's exactly the kind of detail I need to get right.

To summarize the core rule as I understand it: NRAs are generally exempt from US tax on US-source capital gains on publicly traded securities if they were not present in the US for 183 or more days during the year. If that condition is met under domestic law, no US tax and likely no filing obligation unless there's other US-source income or withholding to recover. Treaty may provide additional protection but domestic law often gets you there first.

That summary is accurate. The 183-day rule for NRA capital gains is in IRC section 871(a)(2) and is quite narrow — the gain is taxable only if you were present in the US for 183 days or more during the year, and then only on net gains. Most NRAs with no US presence won't come close.

Nina C.

Author

This is the clearest summary I've seen. No US presence, tax home abroad, gain on publicly traded ETF — sounds like I'm in the exempt category and likely don't need to file unless I have dividend withholding to reclaim.

If you do decide to file a 1040-NR just to be safe or to claim a refund of withheld amounts, the instructions for Form 1040-NR walk through each part including where NRA capital gains go versus FDAP (fixed, determinable, annual, periodical) income like dividends. FDAP is typically subject to 30% withholding (or reduced treaty rate). Capital gains that ARE taxable go in a separate section. Getting those two categories right is the most common structural mistake.

Nina C.

Author

FDAP — that's a new acronym for me. So ETF dividends I received this year may have been subject to that 30% withholding and that's separate from the capital gain question entirely?

Exactly. FDAP income and capital gains are two different tracks on the 1040-NR. Dividends from US ETFs paid to NRAs are FDAP — the broker withholds at 30% or the treaty rate and reports it on Form 1042-S, not 1099-B. If you check your year-end statements and see a Form 1042-S, that's your dividend withholding record and it's what you'd use to claim a refund if you're entitled to a lower treaty rate.

Form 1042-S is the document to look for in your brokerage portal if you received dividends. It shows the gross income, the withholding rate applied and the amount withheld. If your treaty provides a lower rate than what was withheld, you file a 1040-NR to claim the refund. That's often the main reason NRAs end up needing to file even when their capital gains are fully exempt.

irs.gov/publications/p519 covers all of this in one place — residency rules, the NRA capital gains exemption, FDAP, ECI, treaties and the filing threshold for nonresident aliens. It's long but the table of contents is useful for jumping to the section that fits your situation.

The correct address is irs.gov — the IRS publication page has Publication 519 listed there. Worth bookmarking for anyone working through NRA tax questions.