Selling property in the US is taxed, in case it’s sold to a profit, irrespective of the residential status. Thus, non-residents are subject to taxation as well, and ought to file the tax form for the tax period of the sale. It’s important to note, filing the form is mandatory, no matter whether the sale was to a profit or to a loss.
The profit (treated as capital gains) takes place when the selling price is greater than the price of purchase. Profit calculation takes into account all the costs of repairs and major improvements to the property, as well as all costs associated with the process of purchase and sale, such as commissions, government fees, attorney's fees, etc. The tax rate on capital gains is 15-20%, depending on the profit amount.
There is no tax relief for non-residents, due to the duration of ownership, like there is for US residents. For U.S. residents, if the property has been the place of permanent residence of the owner for at least 2 years over the past 5 years, $250 000 is excluded from capital gains and only the remaining gain is taxable. For a married couple, this amount is $500,000.
It’s also worth saying that in case of renting out the acquired property, filing the tax return is mandatory, regardless of the net gain or loss and regardless of the residential status of the owner. This means that non-residents renting property located in the United States, must file an annual tax return.