Are stock sales before passing substantial presence test taxable in US?

I moved to the US in March on an H-1B and I know I won't pass the substantial presence test for this year since I wasn't here enough days. Before I moved I sold some shares through my brokerage back home — these were foreign stocks, sold before I ever set foot in the US. My broker sent me something that looks like it could be a 1099-B but I'm not sure if it even applies to me. I filed as a nonresident the last two years using 1040-NR. Now I'm trying to figure out whether those sales are even reportable on a US return at all, or if the IRS has any claim on gains from before I had any US tax presence. My accountant back home says no, but I want to understand the actual US rule before I assume that.

33 comments

What country were the stocks in, and were they connected to any US business or trade you were running at the time? That matters a lot for whether the IRS can even touch them.

Julia A.

Author

No US business at all. These were shares in a company listed on a European exchange, held in a brokerage account in my home country. Zero US connection as far as I can tell.

This is actually a pretty nuanced residency timing question. The key rule is that for US tax purposes your status as resident or nonresident alien applies to the whole year unless dual-status rules apply. Before you pass the substantial presence test you're a nonresident alien, and nonresident aliens are generally only taxed on US-source income or income effectively connected with a US trade or business. A capital gain from selling a foreign stock through a foreign broker while you were physically outside the US is almost certainly foreign-source income and not taxable to you as a nonresident. I ran my own situation past Taxr at taxr.ai — I uploaded my brokerage statements and my entry dates and it mapped out which sales fell inside vs. outside my residency period and flagged which ones actually needed to go on my 1040-NR. Saved me from reporting gains that weren't mine to report.

Julia A.

Author

That's really helpful framing. So the question is really source of income, not just timing?

Yes exactly. Source rules determine what a nonresident owes. Gains from selling stock of a foreign corporation through a foreign broker while outside the US are generally not US-source, so they fall outside the nonresident's taxable income entirely.

Are you sure you won't pass substantial presence this year? The count includes all days in the current year plus a fraction of prior-year days. If you've been in the US before on any visa it can add up faster than people expect.

Julia A.

Author

Pretty sure — I arrived in March and I haven't been here on any prior visa. My count comes out well below the threshold even with the lookback fractions.

Ok then you're likely nonresident for the whole year unless you make the first-year election, which is a separate thing. Good that you checked.

Even if the gains aren't taxable, does the foreign broker sending something 1099-B-shaped mean you have to put it somewhere on the 1040-NR? Or do you just ignore it?

No, a document that looks like a 1099-B from a foreign broker isn't actually a US Form 1099-B. US brokers issue 1099-B for covered securities. A foreign broker's statement has no IRS reporting obligation attached to it and you don't put it on your return just because it exists.

That makes sense. I assumed any 1099-looking form had to go somewhere.

Worth separating two things: whether the gain is taxable and whether there's a reporting obligation. For a nonresident alien, gains that aren't US-source and aren't effectively connected with a US business generally don't go on the 1040-NR at all. You're not hiding anything by leaving them off — they just aren't within the scope of that return.

Does your home country have a tax treaty with the US? Treaty provisions can sometimes affect what counts as taxable in the US even for nonresidents, though for a plain capital gain on a foreign stock sold before you arrived, the treaty would more likely protect you further than expose you.

Julia A.

Author

There is a treaty. I'll check the capital gains article specifically. From what I've read it generally says the country of residence taxes the gain, which would be my home country for that period.

Right, most treaties follow that pattern for capital gains on movable property — residence country gets the right to tax. Since you were resident in your home country at the time of sale, the US right would be zero or close to it even under treaty.

Dual-status returns are where this can get complicated. If you end up qualifying as a resident at any point this year — say you later pass the test or make the first-year election — you'd file a dual-status return and the nonresident part covers the period before your residency start date. Gains in that nonresident period still follow nonresident rules. I had a dual-status situation last year with stock sales on both sides of my start date and Taxr read through my entry records and brokerage statements and built out a table showing exactly which lots fell in the nonresident window, which fell after, and what belonged on each part of the return. Made the split much cleaner to hand to my preparer.

Julia A.

Author

This is actually where I might end up — I might qualify under first-year election depending on how the rest of the year goes. Good to know the nonresident period gains still keep their character.

What about FBAR or FATCA? A foreign brokerage account with significant value might need reporting even if the income isn't taxable in the US.

Yes, that's separate from income tax entirely. But FBAR and Form 8938 do turn on whether you're a resident or nonresident for income tax — FBAR's 'US person' includes resident aliens as determined under the income tax residency rules, and Form 8938 covers resident aliens and nonresidents who elect resident treatment. So if you stay nonresident all year you generally don't file either, but a first-year election or dual-status year can bring them in. Worth checking those requirements separately from the capital gains question.

Right, so it comes back to the same residency status after all. Easy to overlook that.

Have you confirmed how the substantial presence test counts partial years? A lot of people miss that you count every day you're physically present in the US in the current year, plus one-third of the days in the first preceding year, plus one-sixth from the year before that.

Julia A.

Author

Yeah I ran that count carefully. Even with the fractions from zero prior-year days it's not close for me this year.

The source-of-income rules for capital gains from stock sales by nonresident aliens are actually pretty specific. Gains from selling stock of a foreign corporation are generally foreign-source. Gains from selling stock of a US corporation can be US-source but are still usually not taxable to a nonresident unless they fall into specific categories like real property interests. Publication 519 covers the nonresident alien rules in detail if you want to read the full framework.

Julia A.

Author

The stock was definitely a foreign corporation so that tracks. Good to know there's a specific publication for nonresident rules rather than just the general income rules.

Is there any situation where a capital gain from a foreign stock sale before passing the test could become taxable? Trying to understand where the edge cases are.

Yes, a few: if the stock is effectively connected with a US trade or business you were running, or if it's a US real property holding company (FIRPTA rules), or possibly under certain treaty overrides. For a plain foreign stock held personally with no US nexus, those exceptions almost certainly don't apply.

Ok FIRPTA is a whole different thing. Good to know that's not in play here for a foreign-listed company.

Something I'd double-check is your residency start date if you do end up filing as dual-status. It's not always the first day you arrived — there are rules about when the clock starts, and getting that date wrong shifts which gains fall in which period.

Julia A.

Author

Noted. I was assuming it's my first day in the US this year but I'll verify the exact rule for the first-year election path before I commit to that filing status.

So to pull it together: for the sales you described — foreign stock, foreign broker, while you were outside the US and before any US tax residency — the consensus here is they're not US taxable and don't go on a 1040-NR. The wrinkle is if your status flips later in the year, in which case you're in dual-status territory but the nonresident period still keeps nonresident rules.

Has your accountant back home dealt with US-outbound clients before? The source rules and dual-status return mechanics are US-specific enough that someone without that background might give you the right answer for the wrong reason or miss the FBAR side.

Julia A.

Author

Fair point. They got the right answer but I'm not sure they know the US mechanics behind it. I'll probably use a US-based CPA or enrolled agent who handles international returns to actually file, just to be safe.

Enrolled agent or CPA with international experience is the right call if your year ends up dual-status. Those returns have specific requirements for how you attach the nonresident portion and sign the dual-status statement, and it's easy to do it wrong in a way that creates questions later.