The short version
Remaining a nonresident for federal income-tax purposes does not automatically make your investment gains tax-free. An F-1 student can exclude days from the residency calculation yet owe federal tax on capital gains, the profit from selling an investment. The next questions are how many days you actually spent here, where your tax home was, and what kind of income you earned.
What the law actually says
IRC section 871(a)(2) imposes a 30% tax on qualifying net U.S.-source capital gains of a nonresident present in the United States for at least 183 days during the tax year, unless applicable treaty relief changes the result. This test measures actual presence in that year.
The residency test serves a different purpose. Under section 7701(b), the substantial presence test generally combines all countable days in the current year, one-third of the previous year’s days, and one-sixth of the second preceding year’s days, with a current-year minimum of 31 days. Qualifying F-1 students may exclude days as exempt individuals, generally during their first five calendar years, subject to prior status history and other conditions. Here, “exempt” concerns counting days, not immunity from tax.
The IRS expressly distinguishes these two 183-day rules. Excluding a student day under the residency rule does not erase actual presence for the capital-gains rule. Sheepdog Tax’s F-1 student tax overview provides the starting framework for determining residency before analyzing individual income items.
How it works in practice
Section 865(a) and (g) generally source personal-property sale income by the seller’s specially defined residence. For this purpose, a nonresident alien with a U.S. tax home is treated as a U.S. resident. That sourcing definition does not change the person’s overall income-tax residency. A U.S. brokerage account or a foreign exchange account does not, by itself, resolve the source of an investment gain.
Tax home generally means the area of your regular or main business or employment, with additional rules when no main workplace exists. It can differ from your family home. Publication 463 explains this concept and distinguishes temporary work from employment expected to last longer than one year.
For students, the facts deserve particular care. The IRS’s student tax-home guidance distinguishes studying alone from employment and U.S.-source scholarships or fellowships. Attending a multiyear degree program does not, by itself, establish a U.S. tax home. Employment, funding, expected duration and start dates can change the analysis.
Consider an illustration, not a client case: an F-1 student properly remains a nonresident for a full calendar year, spends 220 actual days here, and has an established U.S. tax home throughout that year. Assume ordinary investment stock sales, no U.S. real-property interests, no special sourcing exception, no treaty relief, and no gain effectively connected with a U.S. business. The sales produce $12,000 of recognized U.S.-source gains and $2,000 of allowable current-year U.S.-source capital losses.
The numbers
The amounts below are assumed inputs illustrating the cited rules, not IRS statistics or a personal tax estimate.
| Calculation | Illustrative result | Authority |
|---|---|---|
| Actual presence compared with the threshold | 220 days exceeds 183 days | IRC 871(a)(2) |
| Qualifying net U.S.-source capital gain | $12,000 minus $2,000 = $10,000 | IRC 871(a)(2) |
| Federal tax on those gains before payments or credits | $10,000 multiplied by 30% = $3,000 | IRC 871(a)(2) |
Publication 519 explains that this calculation does not permit a capital-loss carryover deduction. It is not a tax on gross sale proceeds. The IRS directs qualifying nonbusiness gains taxed under this rule to Schedule NEC of Form 1040-NR. Different facts require a new calculation.
What this means for you
Separate sale gains from other income before applying the example. U.S.-source dividends generally face a 30% tax or an applicable treaty rate without this 183-day threshold. Interest has its own rules, including conditional exemptions for qualifying portfolio interest and certain deposits. Effectively connected income, or ECI, means income connected under the tax rules with a U.S. trade or business; it generally follows graduated rates after allowable deductions. Section 871(a), (b), (h) and (i) distinguishes these categories.
Digital assets require the same discipline. Notice 2014-21 treats convertible virtual currency as property and distinguishes investment sales from mining receipts and payment for services. Revenue Ruling 2023-14 addresses income when a taxpayer gains control of staking rewards. Those receipt rules do not settle a nonresident’s sourcing or ECI analysis. “Nonresident crypto gains are tax-free” is not a reliable conclusion.
Keep travel records, prior visa history, employment and scholarship documents, acquisition costs and transaction statements. Complete the residency documentation described in the Form 8843 guide, then evaluate gains separately. Fewer than 183 actual days does not protect every kind of gain; business income, U.S. real-property interests and specialized transactions have separate rules. Treaty eligibility must be checked against the applicable country agreement and income provision.
Related reading
If your portfolio includes Brazilian pooled investments and your residency may change, the Brazilian investment fund and PFIC guide introduces a separate classification issue. PFIC means passive foreign investment company. Review that issue before assuming every fund belongs in the ordinary-stock example.
How Sheepdog Tax can help
For a scoped assessment of your residency timeline, tax home and investment transactions, contact Noah Green, CPA, CFE, at noah@sheepdogtax.com.
Sources
- IRC 871, nonresident income categories and capital-gains tax.
- IRC 7701(b), residency and exempt individuals.
- IRC 865, personal-property source rules.
- Notice 2014-21, virtual-currency treatment.
- Revenue Ruling 2023-14, staking rewards.
- IRS, capital gains of nonresident students.
- IRS, nonresident students and tax home.
- IRS Publication 463 (2025), chapter 1.
- IRS Publication 519 (2025), chapters 1, 2 and 4.
Prepared by Noah Green, CPA, CFE.