Which Tax Consequences Arise When an Estate Sells Stocks? (w/Examples) + FAQs

When an estate sells stocks, the main tax consequence is capital gains tax, which the estate reports on Form 1041. That tax applies only to growth after the date of death, because the gains that built up during the owner's lifetime are wiped away for tax purposes.

The reason is Internal Revenue Code (IRC) § 1014, the step-up in basis rule. It resets the stock's cost to its fair market value on the day the owner died, which erases decades of potential tax. The executor then has to decide when to sell, weighing that tax break against the risk that the market moves before the sale.

For most families, this income tax is the one that matters. The federal estate tax reaches only estates above the basic exclusion amount, which is $15,000,000 for 2026 deaths and $15,480,000 for 2027 deaths. Far more executors deal with income tax on a stock sale, and the same step-up logic drives capital gains on inherited property of other kinds, such as real estate.

The Two Worlds of Estate Taxes: What Every Executor Must Know

When a person dies, their property becomes an "estate." The person in charge, called an executor or personal representative, has many duties, and handling taxes is one of them. An estate can face two separate federal taxes, and mixing them up causes most of the confusion.

The first is the federal estate tax, a tax on the total net worth of the person who died. It applies only to very large estates. The basic exclusion amount is $15,000,000 per person for 2026 deaths, a level that Public Law 119-21 made permanent and indexed for inflation starting in 2027. For 2027 deaths it is $15,480,000 per person, and an estate below the amount for its year owes no federal estate tax.

Married couples get more room, because a surviving spouse can keep the unused part of the first spouse's exclusion through a portability election on Form 706. The federal answer is not the whole story, though. Some states charge their own estate or inheritance tax, with thresholds far below the federal one, so a federal answer of "no tax" does not settle the state question.

The second tax is the estate income tax. The Internal Revenue Service (IRS) treats an estate as a separate taxpayer. If stocks or savings accounts earn income after the owner's death, that income is taxed, and this is the tax that applies when an estate sells stock at a profit.

Why the Estate Income Tax Is the Real Issue for Most Families

The estate income tax is reported on IRS Form 1041, U.S. Income Tax Return for Estates and Trusts. Under the Form 1041 instructions, an estate must file for any year with gross income of $600 or more, or when any beneficiary is a nonresident alien. A profit from selling stock counts as income, and so do the dividends and interest the account earns along the way.

The estate also gets a $600 exemption on Form 1041. That is a deduction from taxable income, and it is separate from the filing threshold even though the dollar amount is the same. Executors of small estates often ask whether a return is needed at all. If the stock sold at or below its date-of-death value and gross income for the year stayed under $600, usually no Form 1041 is due.

This split is the main idea for an executor to hold on to. Most estates will never file the estate tax return, Form 706, because they fall below the exclusion amount for their year. Many of them will still sell stock to pay bills or to split cash among heirs, and those sales are where an estate pays income tax on what it earned after the death.

Deadlines and Setup for the Estate's Income Tax Return

The estate needs its own tax ID before a broker will retitle the account or sell shares. The executor applies to the IRS for an employer identification number (EIN). The broker then reports every sale under that number instead of the decedent's Social Security number.

The next choice is the tax year. An estate may use the calendar year or pick a fiscal year, as long as its first tax year ends no more than 12 months after the date of death. A fiscal year can push the first filing date back and give the executor more time to finish sales and distributions.

Form 1041 is due on the 15th day of the 4th month after the tax year ends, which is April 15 for a calendar-year estate. Filing Form 7004 by that date gives an automatic 5½-month extension to file. The extension does not move the payment date, so any tax from a stock sale is still due on the original deadline.

Estimated tax is one worry the executor can set aside early on. Under IRC § 6654(l)(2), an estate owes no estimated tax for any tax year ending before the date that is two years after the death. After that, the estate pays quarterly estimates on Form 1041-ES the way a trust does.

Tax TypeWhat It TaxesReturn
Federal Estate TaxThe total value of a person's assets at the moment of death.Form 706
Estate Income TaxIncome generated by the estate's assets after the person has died.Form 1041

The "Magic Eraser" for Taxes: Understanding Step-Up in Basis

The most important rule for inherited stock is the step-up in basis. It comes from IRC § 1014, and it is the starting point for the tax on every sale. It works like a magic eraser for gains that built up over the original owner's lifetime.

Basis is the figure you subtract from the sale price to find your profit or loss. For stock you buy yourself, basis is usually what you paid. Inherited stock is different, because the basis is not what the deceased person paid.

Instead, the basis is "stepped up" to the stock's fair market value on the date the person died. All the growth that happened while the original owner was alive is never taxed. Stock held in the decedent's revocable living trust gets the same step-up, because it is included in the estate.

Imagine your father bought 100 shares of stock for $1,000 many years ago. When he died, those same shares were worth $100,000, and that date-of-death value became the estate's basis in place of what he paid.

How the Step-Up Wipes Out a Potential Tax Bill

The effect of that reset is large. If the executor sells the stock for its market value of $100,000 shortly after the father's death, the taxable gain is zero. The math is the sale price minus the new, stepped-up basis.

$100,000 (Sale Price) – $100,000 (Stepped-Up Basis) = $0 Taxable Gain

The $99,000 of profit the stock earned during the father's life is forgiven by the tax system. That lets an estate sell without a tax bill on decades of growth. It also settles a question many first-time executors ask, because tax is due only if the shares rose after the date of death.

Which Shares Get the Step-Up: Joint Accounts, Community Property and Living Trusts

How the account was titled decides how much of the stock gets a new basis. Shares the decedent owned alone, or through a revocable living trust, get the full step-up to the date-of-death value.

Stock held jointly with a spouse is treated differently. Only the decedent's half is included in the estate, so only that half is stepped up. The surviving spouse keeps the original cost basis on the other half, which means a sale right after the death can still produce a taxable gain.

Community property states are more generous. When one spouse dies, both halves of community property stock get a new basis, including the half the survivor already owned. A couple who paid $20,000 for their shares would see the basis of all of them reset to $200,000 if that is what the shares are worth at the first death.

One exception catches families who plan too cleverly. Under IRC § 1014(e), stock given to the decedent within one year before death gets no step-up if it passes back to the person who gave it, or to that person's spouse. The donor simply gets the old basis back.

Calculating the Tax: The Simple Math Behind Selling Inherited Stock

Figuring the tax on a sale takes two steps. First you find the gain or loss, and then you find the rate that applies to it.

The formula is: Sale Price – Stepped-Up Basis = Capital Gain or Loss. Brokerage commissions and fees come off the sale price, or get added to basis, so they shrink the gain either way.

If the stock's value went up after the date of death, the sale produces a capital gain. If the value went down, the sale produces a capital loss, and that loss can lower the estate's tax.

The Automatic Long-Term Gain Advantage

A special rule makes inherited stock easier to sell. Under IRC § 1223(9), any gain or loss on inherited property is treated as long-term. That holds even if the estate sells the stock one day after the owner's death.

The label matters because long-term gains are taxed at lower rates than short-term gains, which are taxed as ordinary income when an asset was held one year or less. The estate never has to wait out a holding period to get the better rate. On Form 8949, these sales go in Part II, the long-term section.

The Hidden Catch: An Estate's Brutal Tax Brackets

The gain is always long-term, but the rate can still be a nasty surprise. Estates and trusts have very compressed tax brackets, so they reach the top rates at far lower income levels than people do.

An estate pays the 20% long-term rate on taxable income above $16,250 for 2026 and above $16,750 for 2027. A single person does not reach the top long-term rate until taxable income passes $545,500 for 2026 or $563,200 for 2027. Many heirs assume a gain is taxed at 15% because that is what they pay on their own returns, and the estate's return can prove otherwise.

That gap gives an estate a strong reason not to hold on to income. A large gain that an heir could report at a lower rate on a personal return can push most of it into the estate's top rate.

Capital Gains Rate2026 Estates2027 Estates
0%Up to $3,300Up to $3,400
15%Over $3,300 to $16,250Over $3,400 to $16,750
20%Over $16,250Over $16,750

These long-term capital gains thresholds apply to estates and trusts alike. The 2026 amounts come from Rev. Proc. 2025-32, and the 2027 amounts come from Rev. Proc. 2026-35.

The 3.8% Net Investment Income Tax (NIIT) can sit on top of these rates. For an estate, it applies to the lesser of its undistributed net investment income or its adjusted gross income (AGI) above the dollar amount where the 37% bracket begins. That amount is $16,000 for 2026 and $16,500 for 2027, so the combined top rate on an estate's long-term gains is 23.8%.

2026 and 2027 Ordinary Income Tax Brackets for Estates

Not everything an estate earns gets capital gains rates. Interest, nonqualified dividends and income in respect of a decedent are taxed under these four ordinary brackets. Qualified dividends and long-term gains use the 0%, 15% and 20% rates instead.

Ordinary Rate2026 Income2027 Income
10%Up to $3,300Up to $3,400
24%Over $3,300 to $11,700Over $3,400 to $12,100
35%Over $11,700 to $16,000Over $12,100 to $16,500
37%Over $16,000Over $16,500

The income columns show an estate's taxable income. An estate with $20,000 of bank interest is already in the 37% bracket, since that rate starts above $16,000 for 2026. A year with both a big stock sale and other income calls for a look at who should receive that income, the estate or the heirs.

Three Common Scenarios: Seeing the Tax Rules in Action

Three situations come up again and again when an executor deals with inherited stock. Each one uses real numbers, so you can see how the basis, the $600 exemption and the brackets fit together on an actual return.

Scenario 1: The Straightforward Sale at a Gain

An estate sells stock that has gone up in value since the owner died. This is the most common case, and for a small gain the tax is often nothing.

Maria died on February 1, 2026. She owned 100 shares of a company, worth $10,000 on that day. Her executor sells all 100 shares six months later, in the same year, for $12,000, and the estate has no other income.

Executor's MoveTax Outcome
Determine the stepped-up basis.The basis is the value on the date of death: $10,000.
Calculate the capital gain.$12,000 (Sale Price) – $10,000 (Basis) = $2,000 long-term gain.
Subtract the estate's exemption.$2,000 – $600 = $1,400 of taxable income.
Determine the tax.$1,400 is under the 2026 0% ceiling of $3,300, so the tax owed is $0.

The estate still files Form 1041, because its gross income was over $600. For a sale in 2027, the 0% ceiling for estates is $3,400, so the same facts would again produce no tax.

Scenario 2: Selling in a Down Market at a Loss

An estate sells stock that has lost value since the owner died. The sale produces no gain to tax, and the loss can shelter some of the estate's other income.

Use Maria's estate again, but this time the market falls. Her stock was worth $10,000 on her date of death, and the executor sells it six months later for $7,000. The estate also earned $4,000 of interest income that year. Executors often ask whether an estate owes capital gains when stock sells below basis, and the answer here is no.

Executor's MoveTax Outcome
Determine the stepped-up basis.The basis is still the value on the date of death: $10,000.
Calculate the capital loss.$7,000 (Sale Price) – $10,000 (Basis) = $3,000 long-term loss.
Apply the loss to other income.The $3,000 loss offsets the $4,000 of interest, leaving $1,000.
Subtract the exemption and find the tax.$1,000 – $600 = $400, taxed at 10% in 2026, for $40 of tax.

The $400 lands in the lowest bracket because, for 2026, the 10% rate covers an estate's taxable income up to $3,300. The $3,000 figure is also the yearly cap on how much net capital loss an estate can use against other income on Schedule D (Form 1041). Any larger loss carries forward to the estate's next tax year.

Scenario 3: The Executor's Choice: Sell or Distribute the Stock?

The executor must decide whether to sell the stock inside the estate or give the shares directly to an heir. The choice changes who pays the tax and at what rate.

An estate holds stock with a stepped-up basis of $50,000, and the stock is now worth $60,000. The only heir, David, is in a low personal income tax bracket. The estate is in the 20% capital gains bracket, because its other 2026 income already exceeds $16,250. This is the heart of whether an executor should sell estate stocks or distribute them, and the numbers make the answer clear.

Executor's MoveTax Outcome
Option A: Estate sells the stock$10,000 long-term gain taxed at 20% plus 3.8% NIIT. The estate owes $2,380 for 2026. David gets the remaining cash.
Option B: Estate distributes the stock to DavidThe estate recognizes no gain. David takes the $50,000 basis and pays tax on the $10,000 gain at his own rate.

For 2026, the NIIT applies in Option A because the estate's income is already above the $16,000 NIIT threshold for estates. In Option B, David pays $0 if his taxable income, including the gain, stays at or under the single filer's 0% ceiling of $49,450. For 2027 that ceiling is $51,050, and above it he pays 15%.

One trap can undo Option B. If the will leaves David a fixed dollar amount, such as "$60,000," and the executor hands over stock to satisfy it, the transfer counts as a sale. The estate then recognizes the $10,000 gain anyway. The no-gain result applies when the will leaves David the specific shares or a share of whatever remains.

With that trap out of the way, distributing the stock to David is more tax-efficient here. It moves the tax from the estate's high bracket to the beneficiary's lower one.

Capital Gains Usually Stay With the Estate, Except in the Final Year

Many executors expect that handing the sale proceeds to the heirs also hands them the tax. It usually does not. Capital gains are generally left out of distributable net income, the figure that decides how much income a distribution carries out to beneficiaries. So the estate pays the tax on the gain even if it distributes every dollar of cash.

The final year is different. In the year the estate closes, gains pass to the beneficiaries on Schedule K-1 and are taxed on their personal returns. Under IRC § 642(h), unused capital loss carryovers and excess deductions pass to them in that final year too. An estate that sold at a loss does not waste it, because the heirs can use what is left.

Timing gives the executor one more tool. Under IRC § 663(b), the executor can elect to treat distributions made within the first 65 days after the tax year ends as if they were made on the last day of that year. That election lets the executor see the year's final numbers before deciding how much ordinary income, such as interest and dividends, to shift to the heirs.

The Executor's Playbook: Do's and Don'ts for Selling Stock

Managing an estate is a position of trust and legal responsibility. An executor is a fiduciary, which means acting in the best interest of the estate and its beneficiaries, not guessing at the market. Clear habits for how to manage estate stocks protect both the heirs and the executor.

Do'sDon'ts
Do locate brokerage statements to establish the date-of-death value for the step-up in basis.Don't use the original purchase price of the stock. This is the most common and costly mistake.
Do have the broker update the account's cost basis to date-of-death value, and keep the valuation in the estate file.Don't rely on a Form 1099-B that still shows the decedent's old cost.
Do check the will for specific instructions. Some stocks may be promised to a certain heir and should not be sold.Don't sell everything immediately without a plan. Consider the estate's need for cash and the beneficiaries' tax situations.
Do get a separate tax ID number (an EIN) for the estate. The estate is its own taxpayer.Don't forget about state taxes. Some states have their own estate or inheritance taxes with much lower exemptions.
Do consider distributing appreciated stock directly to beneficiaries in lower tax brackets.Don't ignore upcoming dividends. If a stock is about to pay one, waiting for that cash may be wise.
Do work with a qualified tax professional and an estate attorney. The rules are complex, and mistakes can be costly.Don't try to time the market. An executor's duty is to protect the estate's assets, not to trade stocks.

The warning against timing the market matters most when the estate holds one large position, such as years of company shares from a single employer. A stock at a record high can keep rising or fall hard, and neither outcome is the executor's to bet on. Selling down a concentrated holding to cover debts and planned distributions is easier to defend than waiting for a better price.

The Paper Trail: How a Stock Sale Is Reported to the IRS

The paper trail starts with the broker. After the year ends, the broker issues Form 1099-B under the estate's EIN, showing each sale and its proceeds. The executor then carries those numbers through a set sequence of IRS forms.

  1. Form 8949, Sales and Other Dispositions of Capital Assets. Each sale is listed here in Part II (long-term). Enter "INHERITED" in column (b) as the date acquired, then the sale date, the proceeds and the stepped-up basis.
  2. Schedule D (Form 1041), Capital Gains and Losses. The totals from Form 8949 carry over to this schedule, which nets all the estate's gains and losses for the year.
  3. Form 1041, U.S. Income Tax Return for Estates and Trusts. The net gain or loss from Schedule D flows to the main return, where it joins the estate's interest and dividends.
  4. Schedule K-1 (Form 1041), Beneficiary's Share of Income, Deductions, Credits, etc. If the estate distributes income, each beneficiary gets a K-1 and reports that share on a personal Form 1040.

The estate files Form 1041, or a Form 7004 extension request, by the return's due date. The Form 8949 instructions cover the column entries for inherited property.

The K-1 system lets the estate deduct ordinary income it distributes, so the beneficiaries pay that tax, often at a lower rate. Capital gains work differently, because they usually stay taxed to the estate and do not pass out on K-1s. The exception is the estate's final year, when the gains flow to the beneficiaries.

When the Broker's 1099-B Shows the Original Cost Instead of the Stepped-Up Basis

Brokers do not always update an account after a death. The Form 1099-B may show what the decedent paid decades ago, or it may leave the basis box blank. Reporting that old figure would tax the estate on gains that IRC § 1014 erased.

The fix happens on Form 8949. If the 1099-B shows that no basis was reported to the IRS, the executor enters the correct date-of-death basis in column (e). If the 1099-B shows that a wrong basis was reported to the IRS, the executor enters that reported basis in column (e), puts adjustment code B in column (f) and enters the correction in column (g).

Whichever case applies, keep proof of the date-of-death value in the estate file. A brokerage statement for the month of death, or a printout of the high and low trading prices for that day, is usually enough. Without it, an executor facing an IRS question years later has little to show for a number that saved thousands of dollars.

Advanced Topic: The Alternate Valuation Date Election

For very large estates that owe federal estate tax, the executor has one more choice. IRC § 2032 lets the executor value the estate's assets six months after the date of death instead of on the date of death. This is called the Alternate Valuation Date (AVD).

The election can be made only if it lowers both the total value of the gross estate and the federal estate tax owed. It is made on Form 706, and once made it is irrevocable. Only an estate that owes federal estate tax can use it, which for 2026 deaths means an estate above the $15,000,000 basic exclusion amount.

The chosen date reaches every asset in the estate, not only listed shares. An estate that also owns a private company has a harder job, because business interests have no daily market price. Within an estate, business interests are valued by appraisal, and the appraiser sets the fair market value of each business interest as of the valuation date the estate uses.

One rule matters most to an estate that is selling stock. Shares sold or distributed during those six months are valued on the date of the sale or distribution, not at the six-month mark. An executor who sells in month two has locked in the month-two price for estate tax purposes. Our post on using the alternate valuation date for inherited stock walks through the election with examples.

The Critical Trade-Off of Using the AVD

Choosing the AVD creates a real trade-off. It can save a lot of estate tax, but it also resets the stepped-up basis to the lower value used for the estate tax return. A lower basis means a higher capital gains tax when the asset is later sold.

ProsCons
Lowers the federal estate tax bill if asset values have fallen.A lower basis means more capital gains tax when the stock is sold later.
Gives relief to estates holding volatile assets in a falling market.It must apply to all estate assets, not only selected stocks.
The estate tax savings are immediate and certain.It is allowed only if it lowers both the gross estate and the estate tax.
It is irrevocable once made.
It requires filing Form 706.

The executor must weigh the estate tax saved today against the income tax the heirs will pay later. That takes a full look at the estate and at the beneficiaries' own tax situations.

Large estates also face a basis consistency rule. When an estate must file Form 706, the executor must send Form 8971 and its Schedule A to the IRS and to each beneficiary, reporting the estate tax value of what that beneficiary received. Under IRC § 1014(f) and § 6035, an heir cannot claim a basis higher than that reported value when the stock is sold.

Advanced Topic: When the Step-Up Rule Doesn't Apply

Not all inherited assets get a step-up in basis. The main exception is called Income in Respect of a Decedent (IRD). IRD is income the person earned but had not yet received or paid tax on before death.

Common IRD items include traditional individual retirement account (IRA) and 401(k) balances, unpaid wages and bonuses, non-qualified stock options, and untaxed interest on savings bonds. None of these gets a new basis at death. The estate or beneficiary who collects the income pays tax on it, just as the original owner would have.

One deduction softens the blow for large estates. Under IRC § 691(c), a person who reports IRD can claim an itemized deduction for the federal estate tax that was paid on that same income. It applies only when the estate was large enough to owe federal estate tax.

The Tax Trap of Inherited Stock Options and RSUs

Employee stock awards look like stock on an account statement, but each type is taxed under its own rules. An executor deciding how an estate should handle vested stock options needs to sort the awards by type first.

  • Non-Qualified Stock Options (NQSOs): When the estate or heir exercises, the spread between the exercise price and the market value is ordinary income. The company generally reports it on Form 1099-MISC, not on a W-2 in the heir's name.
  • Restricted Stock Units (RSUs): RSUs that vest because of the owner's death are IRD. The market value of the shares on the vesting date is ordinary income to the estate or heir who receives them.
  • Incentive Stock Options (ISOs): Under IRC § 421(c), ISO treatment continues when the estate or heir exercises, and no regular income tax is due at exercise. The option itself gets no step-up in basis.
  • ISO estate tax deduction: IRC § 421(c)(2) treats the option like IRD for this purpose, so the heir may be able to claim the IRC § 691(c) deduction for federal estate tax paid on it.

What happens after exercise differs as well. After an NQSO exercise, the basis of the shares is the exercise price plus the income reported. For ISOs, the holding-period and employment requirements do not apply to the estate or heir. The alternative minimum tax may apply in the year of exercise, and the later gain on the shares is capital gain, not ordinary income. The basis rules for inherited ISO shares are technical, so confirm them with a tax professional before selling.

An executor should identify these assets early. NQSOs and RSUs carry a built-in tax bill at ordinary income rates, which is very different from regular inherited stock.

Example: An Heir Exercises Inherited Non-Qualified Stock Options

A daughter inherits her mother's vested NQSOs for 1,000 shares, with an exercise price of $20 per share. She exercises them in 2026, when the shares trade at $50. She pays $20,000 and receives stock worth $50,000.

The $30,000 spread is ordinary income to her for the year of exercise, and the company reports it on Form 1099-MISC. Her basis in the shares is $50,000, which is what she paid plus the spread she was taxed on.

She later sells the shares for $55,000. Only the $5,000 of growth after exercise is a capital gain, and whether it is short-term or long-term depends on how long she held the shares after exercising. Regular inherited stock with the same value at death would have produced the same capital gain with no $30,000 of ordinary income, which is why these awards surprise heirs.

What to Do Next

  1. Apply for the estate's EIN and have the broker retitle the account in the estate's name.
  2. Pull the brokerage statement for the month of death and record each stock's date-of-death value.
  3. Ask the broker to update the cost basis, then check it against Form 1099-B before filing Form 8949.
  4. Compare the estate's bracket with each heir's bracket before choosing to sell or distribute shares.
  5. Mark the Form 1041 due date, which is April 15 for a calendar-year estate, or file Form 7004.

Frequently Asked Questions (FAQs)

Can an estate sell stock right away?

Yes. Any gain or loss on inherited stock is treated as long-term, no matter how soon it is sold. The estate gets long-term capital gains rates even on a sale made the week after the death.

How do I find the stepped-up basis of a stock?

The basis is the stock's fair market value on the date of death. You can find it on brokerage statements from that month or by looking up historical prices for that specific date.

Does inherited stock in an IRA or 401(k) get a step-up?

No. Distributions from an inherited traditional individual retirement account (IRA) or 401(k) are taxed as ordinary income to the beneficiary. Most non-spouse heirs must empty the account within 10 years. Qualified distributions from an inherited Roth account are tax-free.

What if the estate sells stock for less than its stepped-up basis?

The sale creates a long-term capital loss. It first offsets capital gains, and up to $3,000 of net loss per year can reduce other income. The excess carries forward, and any unused carryover passes to the beneficiaries in the estate's final year.

Do I pay taxes when I inherit stock, or only when it's sold?

You pay no tax just for receiving the stock. Tax is due only when the stock is sold for a profit, and it is figured on the growth after the date of death.

Is it better for the estate to sell stock or for me to inherit it directly?

It depends. If you are in a lower bracket than the estate, inheriting the shares and selling them yourself often costs less. One caveat applies: stock handed over to satisfy a fixed-dollar bequest is treated as a sale by the estate.

What is the difference between an estate tax and an inheritance tax?

An estate tax is paid by the estate before assets are distributed. An inheritance tax is paid by the beneficiaries on what they receive. The federal government has an estate tax only, and a handful of states levy an inheritance tax.

What capital gains rate applies if the estate sells stock in 2027?

For 2027, an estate pays 0% on taxable income up to $3,400, 15% up to $16,750 and 20% above that. The 3.8% NIIT applies above $16,500. The 2026 figures are $3,300, $16,250 and $16,000.

Does the estate have to pay estimated taxes on a stock sale?

No, not for tax years ending within two years after the date of death, under IRC § 6654(l)(2). After that, the estate makes quarterly estimated payments the same way a trust does.

Who pays the tax if the estate sells stock and then distributes the cash?

Usually the estate pays, on Form 1041, because capital gains are not part of distributable net income. In the estate's final year, the gains flow to the beneficiaries on Schedule K-1 and are taxed on their own returns.