Do non–U.S. citizens living outside the U.S. pay taxes on money earned through a U.S. internet broker? That depends.

The tax implications for a foreign investor will depend on whether that person is classified as a resident alien or nonresident alien by the U.S. government. To be considered a nonresident alien, a person must meet several guidelines. First of all, the person cannot have had a green card at any time during the relevant tax reporting period and cannot have resided in the U.S. for more than 183 days in the past three years, including the current reporting period.

However, non–U.S. citizens who hold green cards and have been in the U.S. for at least 31 days during the current year—and more than 183 days in the past three years—are classified as resident aliens for tax purposes and are subject to different guidelines than nonresident aliens.

If You're a Nonresident Alien

If you fall under the nonresident alien category—and the only business you have in the U.S. is in investments (stocks, mutual funds, commodities, etc.) held with a U.S. dollar–denominated brokerage firm or other agent—you are subject to the following tax guidelines, which are explained for the 2019 tax year in IRS Publication 515: Withholding of Tax on Nonresident Aliens and Foreign Entities.

Capital Gains

In terms of capital gains, nonresident aliens are subject to no U.S. capital gains tax, and no money will be withheld by the brokerage firm. This does not mean, however, that you can trade tax free. You will likely need to pay capital gains tax in your country of origin.

Dividends

In terms of dividends, nonresident aliens do face a dividend tax rate of 30% on dividends paid out by U.S. companies. However, they are excluded from this tax if the dividends are paid by foreign companies or are interest-related dividends or short-term capital gain dividends. This 30% rate can also be lower depending on the treaty between your home country and the U.S., so it is important that you contact your brokerage firm to verify the rate.

If You're a Resident Alien

If you are a resident alien and hold a green card—or satisfy the resident rules (183 days)—you are subject to the same tax rules as a U.S. citizen.