In the US 183 Days and Selling Stocks — Is It 30%? First, Separate the Two Rules
The short version: two 183-day rules, two different questions
Nonresidents generally owe no US tax on capital gains from selling US stocks — but two rules share the number 183 and confuse everyone. Rule A decides residency: three-year weighted presence of 183 days makes you a US tax resident, taxed on worldwide income at graduated rates. Rule B decides tax: if you are still a nonresident, were actually present in the US for 183 days or more in the year, and the gains are US-source, a flat 30% tax applies to the net gain. Figure out which rule you are applying before you ask whether tax is due.
| Rule A: residency | Rule B: capital gains tax | |
|---|---|---|
| Authority | IRC §7701(b)(3), Substantial Presence Test | IRC §871(a)(2), Reg. §1.871-7(d) |
| Math | Three-year weighted: this year in full + 1/3 of last year + 1/6 of the year before | Simple sum of days actually present in the current year |
| Threshold | At least 31 days this year, and weighted total ≥ 183 days | 183 days or more in the current year |
| Result | Tax resident, worldwide income at graduated rates | Still a nonresident: flat 30% on net US-source gains |
| Relationship | The two rules have no correlation (per The Tax Adviser) | Never use one rule's math for the other |
Rule A: the three-year weighted test
You meet the substantial presence test if you were present at least 31 days this year and your weighted total reaches 183 days.
- Example 1 (resident): 150 days this year + 90 last year (counts as 30) + 60 the year before (counts as 10) = 190 ≥ 183 → tax resident.
- Example 2 (not resident): 100 days this year + 120 last year (counts as 40) + 120 the year before (counts as 20) = 160 < 183 → test not met.
Once you are a tax resident, Rule B's flat 30% no longer applies — that rule is for nonresidents. A tax resident's stock gains join worldwide income at graduated rates.
Rule B: present 183+ days in the year, still a nonresident
Three conditions must all hold:
- Present in the US for 183 days or more in the taxable year (simple sum; an agent's or partner's presence does not count as yours);
- The gains are US-source (next section — the step most articles skip);
- Not effectively connected with a US trade or business (ECI, see exceptions).
Tax is 30% of the net amount: US-source capital gains minus losses allocable to US sources, for the year. Long- and short-term gains both count; losses under this rule offset in the same year and do not carry over. Counterintuitive detail: in a qualifying year, gains from sales at any time during the year count, even if you were not in the US when the sale happened.
Worked example: a student, still a nonresident, present 200 days in the year, with a US tax home, has US-source gains of $10,000 and allocable losses of $2,000. Net $8,000 × 30% = $2,400.
The step most articles skip: is the gain US-source? It turns on tax home
Section 871(a)(2) taxes only US-source gains. For personal property, source generally follows the seller (IRC §865):
- Tax home outside the US: gains are generally foreign-source — Rule B is not triggered, even if you spent time in the US that year.
- Tax home in the US: gains are generally US-source — combine that with 183+ days of presence and Rule B applies.
The IRS page for students, scholars, and foreign-government employees makes this concrete: most are "exempt individuals" for the substantial presence test and stay nonresidents for years — but if they arrived intending to stay longer than one year, their tax home generally shifted to the US on arrival. Exempt status protects residency, not this capital gains tax.
So the correct order is: ① residency (Rule A) → ② tax home → ③ days present this year (Rule B). Counting days alone and concluding "183 days = 30%" is wrong.
For readers based in China: normally not triggered
If you live in China, your tax home is in China, and you trade ordinary US stocks through a US broker, your gains are generally foreign-source and Rule B is generally not triggered. Do not read this as "nonresidents never pay capital gains tax" — a year spent living long-term in the US must be recalculated on all three steps.
For US-based readers: residency first, tax second
- Tax resident under Rule A → worldwide income at graduated rates, not the 30% flat tax.
- Still a nonresident (exempt individual, closer-connection exception, treaty tie-break, etc.) → run Rule B's three-step check: tax home, days present, net amount.
- If Rule B applies, report on Form 1040-NR, Schedule NEC — not Schedule D — because this is a flat-rate tax, not the ordinary capital gains schedule.
Three exceptions: where "generally not taxed" stops
Exception 1: Effectively connected income (ECI). A professional trader with a substantive US business is taxed at graduated rates, not the 30% flat tax. Merely trading stocks through a US broker does not by itself constitute a US trade or business (per the §864(b)(2) safe harbor principle; confirm your situation with a tax professional).
Exception 2: US real property interests (FIRPTA, IRC §897). Gains from US real property, or shares in a real-property-rich company, are treated as ECI and taxed at graduated rates regardless of the 183 days. Treaty Article 12 paragraphs 4 and 5 reserve the same US taxing right for real-property-rich company shares and for stakes of 25% or more.
Exception 3: Treaty Article 12(6) is not a "reduced to zero" clause. Article 12 (Gains) paragraph 6 of the US–China treaty says gains from other property "arising in the other Contracting State" may be taxed there — it preserves the source country's taxing right and sets no lower rate cap. So the ordinary nonresident's "generally not taxed" result comes from domestic source rules, not from a treaty benefit. Do not write "the treaty cuts capital gains tax to zero." How paragraph 6's "arising in" interacts with §865 sourcing is a matter for the treaty's Technical Explanation and your tax professional.
One more note for China-based readers: no US tax does not mean no filing anywhere
Chinese tax residents report worldwide income under domestic law. Property-transfer income sits in a 20% rate bracket under China's Individual Income Tax Law, but how that applies to overseas-listed stocks — including loss netting and filing routes — depends on the tax authority's position and professional advice. This article does not decide that question; verify it separately before filing.
FAQ
Q1: I spent 100 days in the US this year. Do I owe the 30%? Not under Rule B on days alone: it requires 183+ days in the year plus US-source gains (ECI and FIRPTA aside).
Q2: I'm an F-1 student, present 200 days. Is it 30%? It depends on tax home. If you arrived intending to stay over a year and your tax home shifted to the US while you remain a nonresident, all three Rule B conditions are met. If your tax home is still abroad, the gains are foreign-source and Rule B is not triggered. Check residency → tax home → days, in that order.
Q3: Last year I was present 200 days; this year only 50. How are this year's gains treated? Rule B is annual: under 183 days this year means this year's gains are not counted under Rule B (installment-sale gains from a prior year have special counting rules — ask a tax professional). Rule A's three-year weighting, by contrast, counts last year at 1/3 for residency — don't mix the two formulas.
Q4: Is the 30% on dividends the same 30%? No. Dividends are FDAP, withheld at 30% (or the 10% treaty rate) on the gross amount — see the W-8 article. This capital gains 30% applies to the net amount and only when Rule B's three conditions are met. There is no W-8BEN equivalent for capital gains.
Q5: If Rule B applies, does my broker withhold it? Unlike dividends, capital gains are generally not withheld by the broker at sale; a person caught by Rule B reports on Form 1040-NR, Schedule NEC (filing and withholding are separate questions — follow the 1040-NR instructions for your case).
How this relates to the W-8 article
The W-8 article is about dividends: treaty Article 9 (Dividends) caps withholding at 10%, claimed with a W-8BEN. This article is about sale profits: the treaty provision is Article 12 (Gains), not Article 9 — don't mix them up. Choosing a broker first? See our broker comparison (/en/compare/broker).
Disclaimer: This article summarizes public tax information and is not tax advice. For F/J/H-1B situations, tax-home determinations, and filing, consult a licensed tax professional.
Tags:
Put Your Knowledge Into Action
Use our free financial calculators to apply what you've learned and make informed decisions about your money.
Try Our Calculators