Can You Buy Back Stocks After Selling at a Gain?

Buying back a stock after selling it at a gain is legal, immediate, and requires no waiting period. The IRS treats your sale and your repurchase as two separate transactions: the sale locks in a taxable profit, and the new purchase starts a fresh position with a new cost basis. The wash sale rule that worries loss-sellers does not apply here. What you do need to plan for is the tax bill you just created and a couple of brokerage mechanics that can bite in a cash account.

No Waiting Period, No Wash Sale

Neither the SEC nor any exchange rule prevents you from repurchasing a stock seconds after selling it for a profit. The order sequence is ordinary: one sell, one buy. If you have the funds or margin to cover the new purchase, it executes like any other trade.

The wash sale rule is what most investors have in mind when they ask about buying back quickly, and it simply does not reach gains. Under Internal Revenue Code Section 1091, selling a security at a loss and repurchasing the same or a substantially identical security within 30 days before or after the sale disallows the deduction on that loss.1Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities The rule exists to stop investors from manufacturing tax deductions while keeping the same economic position. When you sell at a gain, you are voluntarily handing the government tax revenue. There is no anti-abuse mechanism to trigger. Sell at 10:00 a.m., buy back at 10:01 a.m., and the tax code has no complaint.

The Tax You Just Owe

Selling stock for more than you paid creates a taxable event. Most stocks are capital assets under the Internal Revenue Code, so the profit is a capital gain.2Office of the Law Revision Counsel. 26 USC 1221 – Capital Asset Defined That liability is fixed the moment your sell order executes. Buying the stock back does not undo it, defer it, or reduce it.

Short-Term vs. Long-Term

How long you held the shares before selling determines the rate. Stock held for one year or less produces a short-term capital gain, taxed at your ordinary income rate. Stock held for more than one year qualifies for long-term rates of 0%, 15%, or 20%, depending on your taxable income.3Office of the Law Revision Counsel. 26 USC 1222 – Other Terms Relating to Capital Gains and Losses For 2026, the 0% bracket runs up to $49,450 in taxable income for single filers and $98,900 for married couples filing jointly; the 15% bracket runs up to $545,500 single and $613,700 joint; anything above lands in the 20% bracket.4Internal Revenue Service. Rev Proc 2025-32 – 2026 Inflation Adjustments Short-term gains get none of those preferential rates. They stack on top of your other income and are taxed at ordinary rates.

The 3.8% Net Investment Income Tax

Higher earners face an additional 3.8% surtax on investment income, including capital gains. This Net Investment Income Tax applies when modified adjusted gross income exceeds $200,000 for single filers, $250,000 for married filing jointly, or $125,000 for married filing separately.5Internal Revenue Service. Topic No. 559, Net Investment Income Tax Those thresholds are not indexed for inflation, so more taxpayers reach them each year.6Congressional Research Service. Net Investment Income Tax Thresholds and Inclusions Stacked with the 20% top capital gains rate, the effective federal ceiling on long-term gains is 23.8%.

Reporting

You report the gain on Schedule D of Form 1040 for the tax year the sale occurred, regardless of whether you reinvested the proceeds.7Internal Revenue Service. About Schedule D (Form 1040), Capital Gains and Losses Your brokerage will send Form 1099-B summarizing each sale, including acquisition date, cost basis, and whether the gain was short- or long-term.8Internal Revenue Service. Instructions for Form 1099-B (2026) Buying the stock back the same day does not change what appears on that form.

Your Cost Basis and Holding Period Reset

When you repurchase, you start fresh. Your cost basis becomes whatever you paid for the new shares, including commissions and fees. The basis of the original position is gone; it was settled when you reported the gain. Any future profit or loss on the repurchased shares is measured from the new purchase price.

The holding period resets to zero as well. To qualify for long-term capital gains treatment on your next sale, you need to hold the new shares for more than one year from the new purchase date.9Internal Revenue Service. Topic No. 409, Capital Gains and Losses The time you held the original shares does not carry over. Your brokerage tracks the new acquisition date automatically for 1099-B reporting.

Plan for the Tax Bill Mid-Year

A large realized gain in the middle of the year can create an estimated tax problem. If your taxes are normally covered by payroll withholding, an extra $50,000 gain can leave you owing thousands more than what’s being withheld. The IRS expects you to pay as you go.

You will generally owe a penalty if you expect to owe at least $1,000 after subtracting withholding and credits, and your payments fall short of either 90% of your current-year tax or 100% of your prior-year tax (110% if your prior-year adjusted gross income exceeded $150,000).10Internal Revenue Service. Estimated Tax The underpayment penalty rate was 7% annualized as of the most recent IRS instructions.11Internal Revenue Service. Instructions for Form 2210 (2025)

The simplest fix is a quarterly estimated payment for the quarter in which you realized the gain. For 2026, the due dates are April 15, June 15, September 15, and January 15, 2027.12Taxpayer Advocate Service. Making Estimated Payments Realize a big gain in August, send a payment by September 15. You can also ask your employer to increase payroll withholding for the rest of the year; the IRS treats withholding as spread evenly across all quarters, which is a useful workaround if you would rather not file estimated-payment vouchers.

Watch Settlement in a Cash Account

No regulation stops you from buying back the stock, but settlement timing can create friction in a cash account. Stock trades settle one business day after execution (T+1), so the cash from your sale is not technically available until the following business day.

In a margin account this is a non-issue. In a cash account, using unsettled sale proceeds to buy shares and then selling those new shares before the original proceeds settle can trigger a free-riding violation under Federal Reserve Regulation T. The consequence is a 90-day account restriction during which you can still trade but must have fully settled cash on hand before placing any buy order.13Investor.gov. Freeriding

For a one-time sell-and-rebuy where you hold the new shares, this rarely comes up. The violation happens when you sell the repurchased shares before the original sale has settled. Most brokers warn you or block the trade before you cross the line.

When Selling and Rebuying Is the Point

Because gains face no wash sale restriction, some investors deliberately sell profitable positions and repurchase them immediately. The strategy is called tax gain harvesting, and it makes sense in specific situations even though it means paying tax earlier than you have to.

The clearest case is the 0% long-term capital gains bracket. If your 2026 taxable income falls below $49,450 single or $98,900 married filing jointly, long-term gains up to those ceilings are taxed at 0% federally.4Internal Revenue Service. Rev Proc 2025-32 – 2026 Inflation Adjustments Selling and rebuying resets your cost basis to the current higher price, which means a smaller taxable gain when you eventually sell for real. Retirees drawing down savings, people between jobs, and anyone having a low-income year are typical candidates.

The strategy also fits investors with unused capital losses to absorb, or those who expect to be in a higher bracket later. The math only works if the tax you pay now is smaller than the tax you would pay later, so it takes some projecting. The absence of any waiting period keeps the mechanics simple.

Retirement Accounts Change the Picture

Everything above is about taxable brokerage accounts. Selling a stock at a gain inside a traditional IRA or 401(k) triggers no capital gains tax at the time of sale. Amounts in a traditional IRA, including earnings and gains, are not taxed until you take a withdrawal, at which point the money is taxed as ordinary income regardless of what produced the growth.14Internal Revenue Service. Traditional IRAs There is no long-term capital gains rate advantage inside these accounts.

Roth IRAs and Roth 401(k)s go further. Contributions are after-tax, so qualified withdrawals in retirement come out tax-free.15Internal Revenue Service. Roth IRAs You can sell and rebuy inside a Roth as often as you want with no gain to report, no new basis to track, and no estimated payment to worry about. The sell-and-rebuy calculus in this article is really a taxable-account question.

State Taxes Add Another Layer

Federal taxes are not the whole picture. Most states tax capital gains as ordinary income, with rates running from roughly 2% to over 13% depending on where you live. A handful of states impose no income tax and therefore no state-level capital gains tax. One state taxes only capital gains above $250,000. Two investors realizing the same gain can face meaningfully different total tax bills based on residency alone. Factor your state rate into the calculation before deciding whether a sell-and-rebuy pays off, especially for tax gain harvesting near the 0% federal bracket, where state tax can quietly eat the expected savings.