US capital gains tax for foreign investors — what actually applies?

Trying to sort out the us capital gains tax for foreign investors situation before I file. I'm a nonresident alien, tax treaty country, and I sold shares in a US-listed ETF this year through a brokerage account I opened in my home country. The broker sent something that looks like a 1099-B but my accountant back home has never seen one. I also sold shares in a foreign corporation listed only on a foreign exchange — no US nexus that I can tell. I keep reading that nonresident aliens generally aren't taxed on capital gains unless the gains are "effectively connected" with a US trade or business, but I keep hitting walls about what that means in practice and whether the ETF counts. Does anyone here know how this actually works? Is there a form involved, and does the treaty change anything?

32 comments

Form 1040-NR is the return for nonresident aliens. If you have US-source income that isn't wages or dividends, that's where it goes. Capital gains from US securities sold by a nonresident alien who is NOT engaged in a US trade or business are generally exempt from US tax under the Internal Revenue Code — but that exemption has real conditions and treaty provisions can either help or complicate things depending on the country.

Elena M.

Author

That's the direction I was looking — the 1040-NR. So the base rule is exemption, and I layer the treaty on top of that? Or does the treaty have to do the work if the base rule doesn't cover my situation?

The "effectively connected" language matters a lot here. Capital gains are effectively connected only if they're connected with a US trade or business; separately, if you were present in the US for 183 days or more during the tax year, your net US-source capital gains that aren't effectively connected are taxed at a flat 30% (or lower treaty rate). If neither applies, the gains generally aren't taxed at the federal level regardless of a treaty.

The 183-day rule for capital gains on a 1040-NR is a separate rule from the substantial presence test for residency. Both count days differently. Easy to mix them up.

Elena M.

Author

I was not present in the US at all this year, so it sounds like the federal exemption covers me for the ETF gains. Still not 100% sure about how the broker's 1099-B fits in.

Publication 519 (US Tax Guide for Aliens) covers the effectively connected income rules in detail. The IRS digital assets page at irs.gov/businesses/small-businesses-self-employed/digital-assets also covers some of this for crypto but the same ECI analysis applies. For your ETF situation I'd look at Publication 519 first before anything else.

Schedule D and Form 8949 are only relevant to you if the gains are actually taxable in the US — meaning ECI or a treaty provision that overrides the exemption. I uploaded my broker statements and a treaty summary document to taxr.ai last year in a similar situation and it flagged which line items had US-source indicators versus foreign-source, and drafted a memo explaining what the 1099-B boxes meant for a nonresident. Really helped me hand something concrete to my preparer. The rule itself you need a qualified preparer for, but the document sorting was the time-consuming part.

Elena M.

Author

That document sorting piece is exactly what's slowing me down. My broker statement mixes trades from three different exchanges and I can't tell which ones have any US nexus.

One thing worth knowing: if your gains ARE taxable in the US as ECI, you report them on Form 1040-NR, Schedule NEC is for fixed or determinable annual or periodical income (dividends, interest), and Schedule D on the 1040-NR covers capital gains. The rates that apply to ECI capital gains for a nonresident are the same graduated rates as for residents when effectively connected.

Correct on the form. And the holding period still matters — over one year is long-term, one year or less is short-term — same thresholds as for a resident.

The ETF question is trickier than it looks. A US-listed ETF is a US corporation for tax purposes in most cases. Gains on sale of stock in a US corporation by a nonresident alien are generally not subject to US capital gains tax under the Code — but FIRPTA (Foreign Investment in Real Property Tax Act) is a separate issue if the ETF holds significant US real property interests. Most broad equity ETFs don't trigger FIRPTA but a US REIT ETF could.

Elena M.

Author

Mine is a broad equity index ETF, not a REIT-focused one. So FIRPTA probably doesn't apply but I'll double-check the fund's classification.

FIRPTA withholding falls on the buyer in a direct real property sale, but for publicly traded REITs and certain ETFs the rules differ — look at the fund prospectus for a "USRPHC" or "USRPI" disclosure. If it's a plain S&P 500 tracker you're almost certainly fine.

Treaty question: most US tax treaties have a capital gains article. The standard OECD-based treaty gives the country of residence the exclusive right to tax capital gains from movable property (stocks) unless the property is part of a permanent establishment in the US. So if your country has a treaty with the US and you have no US permanent establishment, the treaty typically confirms the exemption the Code already gives.

Don't overlook the W-8BEN. If you hold the account at a US broker or a broker that follows US withholding rules, they need a valid Form W-8BEN on file to avoid backup withholding. That form also lets you claim treaty benefits on dividends. It doesn't directly reduce capital gains tax (which is usually zero anyway) but without it the broker may withhold on proceeds.

W-8BEN has to be renewed every three years or when your circumstances change. A lot of foreign investors let it lapse and then get surprised by withholding.

Elena M.

Author

My broker did ask for this form when I opened the account. Good to know it needs renewing — I'll check when mine expires.

Form W-8BEN versus Form W-8ECI is a distinction that trips people up. W-8BEN is for income NOT effectively connected to a US trade or business. If your gains are ECI — which for most passive investors they won't be — you'd need Form W-8ECI instead, and you'd be filing a 1040-NR and paying US tax. I had Taxr go through my broker's withholding statements and the two W-8 forms side by side; it listed which income items on each 1099 matched which form category so I could see at a glance where I stood before handing everything to my CPA.

W-8ECI doesn't get attached to your 1040-NR filing. It's just for the broker (the withholding agent), not part of the return itself.

If you end up owing no US tax and have no ECI, you may not need to file a 1040-NR at all. The obligation to file depends on whether you have US-source income that is taxable or income subject to withholding. Pure capital gains exempt under the Code and treaty generally don't create a filing obligation — but check the 1040-NR instructions for the income threshold rules.

Dividends are different from gains here. If the ETF paid dividends, those are US-source income subject to 30% withholding (or the treaty rate), and that could trigger a filing obligation or at least a reconciliation on 1040-NR, Schedule NEC.

Elena M.

Author

The ETF did pay dividends. So even if the capital gain is exempt, the dividend withholding is a separate issue I need to look at on the 1040-NR?

Exactly. The broker should have withheld at the treaty rate if your W-8BEN was on file claiming treaty benefits. If too much was withheld, you file a 1040-NR to claim a refund. If the right amount was withheld and it's your only US income, check the 1040-NR instructions on whether filing is still required — it varies.

The foreign corporation shares you mentioned — listed only on a foreign exchange — almost certainly produce no US-source gain. Gains from the sale of stock are sourced to the residence of the seller under US rules, not where the company is incorporated or listed. So as a nonresident you'd owe nothing to the US on that sale.

Sourcing rules for gains are in Publication 519. For nonresident aliens, capital gains on personal property are generally sourced to the seller's country of residence, which is why most stock gains escape US tax entirely for nonresidents.

Form 8833 is what you use to claim a treaty-based return position that overrides the Code. If your treaty explicitly exempts something the Code would otherwise tax, you're supposed to file Form 8833 disclosing the treaty position. In practice for straightforward nonresident capital gains that are already exempt under the Code, Form 8833 often isn't needed — but if you're relying on the treaty for something not covered by the Code, attach it. I ran my situation past Taxr — gave it my treaty's capital gains article and the relevant pages of my 1040-NR draft — and it mapped each income item to either the Code exemption or the treaty article so I could see exactly which form 8833 disclosures were actually necessary. Saved me and my preparer a lot of back-and-forth.

Form 8833 also has a threshold — it's not required for every treaty position, only ones above a certain dollar amount or of a certain type. The instructions for Form 8833 spell out the exceptions.

State tax is a separate question from federal. Some states tax nonresident aliens on income sourced to that state. If you held the ETF in a brokerage account with a US address (say, a custodian in a particular state), some states may assert nexus. It's unusual for pure stock gains but worth asking your preparer about if any of your accounts have a US-state address.

Publication 550 covers holding period rules at irs.gov/publications/p550 and they apply the same way for nonresident alien filers who do have taxable gains — trade date in, trade date out, day after acquisition starts the count. If you end up with ECI gains, the long-term versus short-term distinction still matters for which rate column applies on the 1040-NR.

Also worth noting: inherited property held by a nonresident alien still gets the step-up in basis rules that apply to residents — the basis becomes the fair market value at the date of the decedent's death, and it's treated as long-term regardless of how long you actually held it. That's in Publication 550 as well.

To summarize the practical path for your situation: (1) confirm no US physical presence exceeding the 183-day capital gains threshold, (2) confirm the ETF is not a USRPHC, (3) check that your W-8BEN is current with your broker, (4) look at the dividend withholding on 1040-NR Schedule NEC, (5) decide whether a 1040-NR is required based on the dividend income. For the foreign-listed shares, you're almost certainly done — no US reporting needed.

Elena M.

Author

This is the clearest path I've seen laid out. I'll start with steps 1 and 2 this week. The dividend piece on Schedule NEC is where I'll probably need a preparer who knows nonresident returns.