A wash sale is a security sale at a loss with a repurchase of a substantially identical security shortly before or after the sale. The IRS designed the rule to limit the tax advantages of taking the losses if the investor doesn't take some risk.
For example, if you immediately swap out a high-cost-basis stock for an identical, lower cost-basis stock, you're avoiding the risk of missing returns; you'd get the tax advantage without the risk.
Wash sale rules apply across accounts and households—a family cannot avoid the wash sale rule by selling stock in a husband's account and buying it back immediately in the wife's account.
In the event of a wash sale, the losses are disallowed and the cost basis of the repurchased stock increases by the amount of the disallowed loss.