Do non residents pay capital gains tax in the US?

Trying to figure out if non residents pay capital gains tax on US investments. I'm on a J-1 visa, been here about 14 months, and I sold some shares in a US brokerage account in October. The broker sent a 1099-B showing proceeds and cost basis. I'm pretty sure I'm a nonresident alien for tax purposes because I don't think I pass the substantial presence test, but I'm not 100% certain. My tax software keeps trying to put me on a 1040 instead of a 1040-NR and I'm getting confused about which rules apply. Do I owe capital gains tax on those stock sales, and if so how does it get reported? The 1099-B just shows the numbers, it doesn't say anything about residency.

34 comments

What kind of stocks were these — US companies listed on a US exchange, or foreign companies? And were you selling shares you bought while you were already in the US, or ones you held before you arrived? Those details change the answer pretty significantly for a nonresident alien.

Amara D.

Author

US companies, all listed on major US exchanges. I bought them after I arrived on the J-1 so the whole holding period was while I was physically here. Does that matter?

The residency question really is the starting point. For tax purposes, nonresident alien status turns on the substantial presence test and the visa type — J-1 holders often qualify as exempt individuals for counting days, which can keep you NRA status longer than you'd expect. I had a similar situation last year and uploaded my 1099-B and visa documents to taxr.ai; it read through the documents and laid out which lines on the 1040-NR applied to my sales and which didn't. Pointed me to the right IRS pages so I could verify everything myself. Worth doing before you pick a form.

Amara D.

Author

I didn't know J-1 holders could be exempt from the day count. That would definitely change things. I'll check the substantial presence test rules more carefully.

Are you sure your broker withheld anything? Because for a nonresident alien selling shares of a US corporation on a US exchange, there's actually an exemption that often applies — portfolio interest and capital gains from the sale of stock aren't always subject to US tax for NRAs. But it depends on the type of gain.

This is roughly right but needs a bit more precision. The exemption for nonresident aliens generally covers gains from selling stock of regular US corporations traded on an established securities market — those are not US source income for NRA purposes in most cases. But US real property interests, including stock in certain real estate holding companies, are treated differently under FIRPTA.

Amara D.

Author

No withholding at all. The broker just sent the 1099-B with the full proceeds. So if the exemption applies I might not owe anything on these sales?

Which country are you a tax resident of? There might be a tax treaty between that country and the US that also affects this, on top of the domestic rules. Treaties can sometimes give nonresidents better treatment or sometimes impose additional requirements.

Amara D.

Author

I'd rather not say the specific country but it does have a tax treaty with the US. I didn't know treaties could affect capital gains differently — I assumed it was all one rule.

The basic framework for a nonresident alien: capital gains from selling stock of a US corporation on an established US securities market are generally not treated as US source income, so they're usually not subject to US federal income tax for a true NRA. This is different from how it works for US residents and citizens. The form for nonresidents is the 1040-NR, not the regular 1040. Your tax software defaulting to 1040 is a problem if you're actually a nonresident.

Important addition: if you were physically present in the US for 183 days or more in the tax year AND you have US source gains, there's a special rule under section 871(a)(2) that can subject certain capital gains to a flat tax rate — check the 1040-NR instructions for how that line works. That's separate from the general NRA exemption.

Amara D.

Author

I need to count my days carefully then. I arrived partway through the year so I'm not sure if I hit 183 days in the calendar year or not. That seems like it could completely change the answer.

The 183-day rule mentioned above is real but it's a different test from the substantial presence test for residency. You can be an NRA under the substantial presence test and still have US source capital gains taxed under that separate provision if you were here 183 days in the tax year. They're not the same calculation.

Has anyone dealt with FIRPTA in this context? The poster said all US-listed stocks, so probably not an issue, but I had a situation where I owned shares in a company that turned out to be a US real property holding corporation and the rules were totally different — the broker was supposed to withhold.

FIRPTA applies to US real property interests, which includes stock in a US real property holding corporation. Regular stock in a typical US operating company traded on an established securities market generally isn't a USRPI. So for most brokerage accounts holding S&P 500 type stocks, FIRPTA isn't the issue. Worth knowing about though.

The 1040-NR has a specific schedule for capital gains — Schedule NEC covers income not effectively connected with a US trade or business, and Schedule D on the 1040-NR covers gains that ARE effectively connected. Which schedule you use depends on whether you have a US trade or business. Passive investment through a brokerage is usually not a US trade or business. I actually had Taxr go through my 1040-NR line by line when I had stock sales as an NRA — it read through each schedule and told me which lines were relevant for my type of income and flagged the ones I'd filled in wrong.

Amara D.

Author

So the schedule matters based on whether the income is effectively connected or not. How do I know if my investment income counts as effectively connected?

Passive portfolio investment — just buying and selling stocks through a regular brokerage account — is generally not treated as a US trade or business, so the gains would go on Schedule NEC rather than Schedule D of the 1040-NR. But if you're doing something more active, like a trading business, the analysis changes. For most people with a regular brokerage account, it's not effectively connected.

Does your brokerage know you're a nonresident? Because they should have had you fill out a W-8BEN when you opened the account. If they have you in their system as a US person, they may have reported things to the IRS on a 1099-B in a way that assumes US person status.

Amara D.

Author

I honestly don't remember signing a W-8BEN. I might have just given them my SSN and they treated me as a US person. Is that a big problem?

It could complicate things. The W-8BEN certifies your foreign status so the broker withholds correctly and reports correctly. If they have you as a US person, the 1099-B reporting is for a US person. You'd still file a 1040-NR if you're actually an NRA, but you should contact your broker to sort out the account classification for future years at minimum.

Worth saying plainly: figuring out whether you pass the substantial presence test when you're on a J-1 is genuinely complicated because J-1 holders can be exempt individuals, meaning those days don't count toward the 183-day presence threshold, but only for a limited number of years. The IRS page on alien residency tests walks through it and so do the 1040-NR instructions.

My experience as a former F-1 holder: I had stock sales in a year where I was definitely NRA, and the gains from selling US-listed equities were not taxable in the US under the general NRA rules. Filed a 1040-NR, left those sales off because they weren't US source income for me, and that was that. I uploaded my 1099-B and my visa timeline to Taxr and it walked through the sourcing rules for each transaction, flagged which ones could be excluded and drafted a summary I used as a checklist when I actually filled out the 1040-NR. Saved me a lot of confusion on the schedules.

Amara D.

Author

This is really helpful to hear. So for plain US-listed equity sales through a brokerage, as a true NRA, the typical outcome is they're just not US source and you don't report them on the 1040-NR at all?

Generally yes, that's the result for sales of stock in regular US corporations on established US markets — they're not treated as US source income for NRA purposes so they don't appear on your 1040-NR. But confirm you're actually NRA status first, check the 183-day provision mentioned earlier, and check whether any treaty provisions apply. The 1040-NR instructions and Publication 519 cover the sourcing rules.

The treaty point is real. Some tax treaties between the US and other countries have specific articles on capital gains that can modify the domestic rules in either direction. You'd need to look at the specific treaty article for capital gains and see if it applies to your situation. Treaty benefits for NRAs on a 1040-NR are claimed on Schedule OI.

Are there any dividends in this account too? Because dividends are treated very differently for NRAs than capital gains — dividends from US corporations are generally US source income for NRAs and are subject to withholding tax, usually at 30% unless a treaty reduces it. So don't assume the same NRA exemption that covers capital gains also covers dividends in the same account.

Amara D.

Author

Yes there are some dividends, small amounts. I didn't even think about those being different. I'll need to check what the broker did with those.

Check the 1099-DIV — it should show any federal income tax withheld in box 4. If your broker had you as a US person, they may not have withheld anything at all, which could mean you owe on the dividends even if you owe nothing on the stock sales.

Stepping back — for someone with this many moving parts (visa type, residency status, potential treaty, both gains and dividends, broker classification question) this is probably worth at least a consultation with a CPA or enrolled agent who handles international returns. The 1040-NR is not the same as a regular return and mistakes in either direction (filing as a US person when you're NRA, or missing income that is actually US source) have real consequences.

Amara D.

Author

You're probably right. I was hoping I could sort it myself but between the substantial presence test for J-1s, the 183-day separate rule, the treaty question, and the dividend issue, it's more than I expected.

To summarize the core answer: nonresident aliens generally do NOT pay US capital gains tax on gains from selling stock of US corporations on US exchanges, because those gains are not US source income under the domestic rules. The main exceptions are FIRPTA property, the separate 183-day rule for certain gains if you were physically present that long in the tax year, and any treaty provision that changes the result. File 1040-NR not 1040. Confirm your NRA status first — that's the whole foundation.

One correction to what was said earlier about the 183-day provision: it applies to capital gains that are US source gains from an NRA who was present in the US for 183 days or more in the tax year, and there's no requirement that they lack a US tax home (having a US tax home is actually what generally makes those gains US source). The 1040-NR instructions explain exactly how the calculation works and which line captures it. Don't apply it without reading the instructions carefully because the conditions matter.

Good catch on the tax home point, though it works the other way: there's no no-tax-home condition, and a US tax home generally makes the gains US source. That detail is easy to miss and it does affect whether the provision applies at all.