When you are in the United States on a non-immigrant visa, you may be subject to U.S. federal income tax if you have any taxable income in the U.S. The rules for non-residents of the U.S. are different from the rules for U.S. citizens and residents, who are generally subject to U.S. income tax on their worldwide income.
You may be considered a resident of the U.S. for tax purposes, even if you are not a resident for immigration purposes, if you meet what the IRS calls the physical presence test. You meet this test if you have been physically present in the United States for at least 31 days during the current year and a total of 183 days during the current year and the two prior years. A weighting formula is used to determine this total, including all the days you were present in the current year, one third of the days you were present the previous year, and one sixth of the days the year before that.
If you meet the physical presence test and you were physically present in the U.S. for at least 183 days during the current year, you are considered a resident of the U.S. for tax purposes. If you meet the physical presence test but were present in the U.S. for less than 183 days in the current year, and you can show that you have a tax home in a foreign country and have a closer connection to that country than to the U.S., you would be considered a non-resident for U.S. tax purposes. To apply for this exception you would have to file Form 8840, Closer Connection Exception Statement for Aliens, with the annual U.S. income tax return you file on either Form 1040NR or Form 1040NR-EZ.
According to the IRS, certain individuals temporarily in the United States are considered exempt from the rules for the physical presence test. These include regular commuters from Canada or Mexico; crew members of foreign vessels; foreign government-related individuals under an A or G visa; teachers or trainees in the U.S. under a J or Q visa; students in the U.S. under an F, J, M or Q visa; and professional athletes who are temporarily in the U.S. to compete in a charitable event.
The IRS also points out that you may be considered a non-resident under the provisions of a tax treaty the U.S. has with another country. You can find more information on how tax treaties can affect your income tax on the IRS website.
If you are considered a resident for tax purposes based on the physical presence test, you would be subject to U.S. income tax on your worldwide income. According to the IRS, if you are a non-resident of the U.S. you would be subject to U.S. federal income tax on income you earn from sources in the U.S. and on certain income that is connected with the conduct of a trade or business in the U.S.
Depending on the state where you live while in the U.S., you may also be subject to state income taxes on income you earn in that state. You should consult the state’s Department of Revenue or equivalent website to find out the rules for state taxation of persons who are not U.S. citizens or residents.
Sources:
Form 1040NR, U.S. Nonresident Alien Income Tax Return
Form 8840, Closer Connection Exception Statement for Aliens
Publication 519, U.S. Tax Guide for Aliens, IRS
Tax Treaties Can Affect Your Income Tax, IRS