What if I sold an asset that will result in a profit, instead of a loss, but then buy it back within 30 days. Will this profit be taxable?
Yes, you will owe tax on the realized gain. But your newly-purchased shares will have a higher cost basis, potentially reducing the taxable gain of future sales (or increasing the deductible loss).
Strategically doing this during a lower-income year to save money on taxes is called tax-gain harvesting. Depending on income and filing status, you could realize some long-term gains and pay 0% tax, then repurchase at a higher basis.
A wash sale violation occurs if you acquire a 'substantially identical' security within 60 days (30 before or 30 after) of realizing a loss. It has nothing to do with realizing a gain.
A wash sale applies to options and equities (not futures). It also applies to short positions as well.
Not that it's applicable to most here but it's different for short positions:
If you close out a short sale for a profit, the normal trade date and settlement date reporting rules apply. However, if you cover the short at a loss, you report the transaction as of the settlement date.
Therefore, if you want to close out a losing short position this year so that you can deduct the loss this year, you must buy back the shares no later than two business days BEFORE the last trading day of this year, so that the trade has time to settle before the new year begins.