Tool · methodology

The charitable-giving optimizer: which lots leave the portfolio without realising the gain

Picking the appreciated lots whose in-kind donation maximises capital-gains tax avoided, subject to a TE-preservation cap on the residual portfolio. The objective, the AGI-cap binding, and the difference between gifting cash and gifting stock at scale.

May 202610 min read

Donating cash to a qualified charity gives the donor a deduction equal to the cash amount. Donating long-term appreciated stock gives the donor a deduction equal to the stock's fair market value, and avoids the capital-gains tax on the embedded appreciation. The arithmetic almost always favours the stock — but only if the donor picks the right lots. The charitable-giving optimizer does that selection: which lots leave the portfolio without realising the gain, subject to a cap on how off-track the residual portfolio drifts.

Input
Portfolio + gift target
Output
Lot-level donation list
Tax effect
Embedded gain not realised
Deduction at
FMV (subject to AGI cap)
The model

Maximise embedded-gain donated, subject to TE preservation

Charitable-giving optimizer
max   Σ_i  embedded_gain_i  ·  donate_i
 donate

s.t.   Σ_i  fmv_i  ·  donate_i   =  G                  (gift target met)
       0  ≤  donate_i  ≤  shares_i                      (per-lot ceiling)
       TE(w_after) ≤ TE_max                             (TE preservation)
       AGI cap on FMV deduction (optional, deferred)
Source: TaxView optimizer, charitable_giving_optimizer. donate_i = number of shares of lot i to donate; G = dollar gift target; TE_max = the holder's TE preservation cap.
Why give appreciated stock, not cash

The arithmetic, in one box

The charity is indifferent between cash and stock — either way they liquidate. The donor is not. The "give stock" path delivers the same deduction as a $250k cash gift while keeping the $43,860 of would-be capital-gains tax in the donor's pocket. The optimizer's job is to maximise that delta — equivalent to maximising the embedded gain in the donated lot list.

Donating appreciated stock is the rare structure where the donor's tax-saving and the charity's economics align with the same trade.

Why TE preservation matters

Concentrated donations skew the residual portfolio

The lots with the largest embedded gain are usually the names that compounded the most — which means they're often the biggest positions in the residual portfolio. Donating them away without replacement leaves the residual book under-weighted in those names relative to the benchmark, which widens TE. The TE-preservation constraint limits that drift. If TE_max is loose, donations cluster in the deepest-appreciated names; tight, and they spread across the portfolio.

Worked example

$10M direct-indexing account, $250k gift, 50 bp TE cap

Representative output
Lots flagged for donation9 (out of 612)
Total gift FMV$251,200
Embedded gain in those lots$184,300
Capital-gains tax avoided · @ 23.8%$43,860
Tax avoided per dollar gifted≈ 17 ¢
Post-gift TE vs benchmark31 bp
Targeting the nine highest-embedded-gain lots clears 73% of the gift's dollar value as untaxed appreciation, while keeping residual TE inside the 50 bp cap.
The AGI cap interaction

When the deduction phases in over years

Long-term appreciated stock donated to a public charity is deductible at FMV up to 30% of the donor's AGI. Excess deduction carries forward five years. For donors with high net worth and modest income, the AGI cap binds — and the optimizer can be told to size the gift to the cap rather than to a dollar target. Pass {agi_cap: 0.30, agi: $X} and the constraint becomes Σ FMV · donate ≤ 0.30 × AGI.

What the optimizer doesn't decide

The vehicle question

The tool returns a list of lots and shares. It doesn't pick the receiving vehicle — direct charity transfer, donor-advised fund (DAF), private foundation. Each has different tax consequences (DAFs preserve the donor's flexibility on which charity ultimately receives; private foundations have stricter AGI limits on appreciated-stock donations). That's a conversation for the donor's adviser, downstream of the optimizer's output.

Limitations

What's not in scope

  • Short-term lots are excluded by default. Short-term appreciated stock is deductible only at basis, not FMV. The optimizer filters them out unless the holder explicitly opts them in (rare).
  • Bunching strategies. Donors who alternate "give heavily one year, take the standard deduction the next" benefit from a multi-year version of this optimizer; that's a planning conversation, not a one-shot output.
  • State deduction asymmetries. Some states cap or disallow charitable deductions; the federal-equivalent number the optimizer surfaces overstates the after-state benefit in those states.

For the related concentrated-position tool, see the options overlay deep-dive. For the year-end harvest tool, see year-end loss harvest maximiser.

Notes & references
  1. IRC §170 — Charitable contribution deduction. The 30% AGI cap on long-term appreciated stock to public charities is in §170(b)(1)(C).
  2. Stein (1998). Diversification of Concentrated Holdings. JWM 1(2). The charitable channel is one of the canonical 'release without realisation' techniques.

Educational illustration · numbers illustrative. Not investment, tax, or legal advice.

Related