4 min read
On this page

Tax Optimization for Engineers

Tax optimization is not tax evasion. It's using the legal mechanisms built into the tax code to keep more of what you earn. The government intentionally created tax-advantaged accounts and deductions to incentivize retirement savings, healthcare spending, and charitable giving. Not using them is leaving money on the table.

The Tax-Advantaged Account Hierarchy

Max out these accounts in roughly this order. The exact order depends on your situation, but this is the general priority:

Priority  Account         2025 Limit    Tax Benefit
1         401k match      Varies        100% return (free money)
2         HSA             $4,150        Triple tax advantage
3         401k (full)     $23,500       Pre-tax or Roth
4         Roth IRA        $7,000        Tax-free growth (if eligible)
5         Mega backdoor   $46,000*      Roth conversion (if available)
6         Taxable broker  Unlimited     Long-term capital gains rates

*Total 401k limit including employer contributions

Step 1: Get the Full 401k Match

If your employer matches 401k contributions, contribute at least enough to get the full match. This is the highest-return investment available to you — it's literally free money.

Example: Employer matches 50% up to 6% of salary
  Salary: $200,000
  Your contribution (6%): $12,000
  Employer match (50% of 6%): $6,000
  Total going into 401k: $18,000

  If you contribute 0%: You give up $6,000/year.
  Over 30 years at 7%: That's $567,000 in lost growth.
  From not checking a box on a form.

Step 2: Max the HSA

The Health Savings Account is the most tax-efficient account in the US tax code. It has a triple tax advantage that no other account offers:

HSA Triple Tax Advantage:

1. Contributions are pre-tax (reduces taxable income)
2. Growth is tax-free (no tax on dividends or capital gains)
3. Withdrawals are tax-free (if used for medical expenses)

No other account offers all three.

  401k: Pre-tax in, tax-free growth, TAXED on withdrawal
  Roth: Taxed in, tax-free growth, tax-free withdrawal
  HSA:  Pre-tax in, tax-free growth, tax-free withdrawal*

  *For qualified medical expenses. After age 65, withdrawals
   for any purpose are taxed as ordinary income (like a 401k).

Requirements: You must be enrolled in a High Deductible Health Plan (HDHP). The 2025 limit is 4,150forindividualcoverage,4,150 for individual coverage, 8,300 for family.

The optimal HSA strategy: contribute the max, invest it in index funds, pay current medical expenses out of pocket (save the receipts), and let the HSA grow tax-free for decades. You can reimburse yourself for those medical expenses at any point in the future — there's no deadline.

Step 3: Max the 401k

After getting the full match and maxing the HSA, fill up the rest of your 401k to the $23,500 limit.

Traditional vs Roth 401k:

Traditional (pre-tax):
  Reduces taxable income now.
  Taxed as ordinary income when withdrawn in retirement.
  Best if: you expect to be in a lower tax bracket in retirement.

Roth (post-tax):
  No tax benefit now.
  Grows tax-free. Withdrawals are tax-free in retirement.
  Best if: you expect to be in a higher tax bracket in retirement,
           or you want tax diversification.

For most engineers in their 20s-30s earning $150-300k:
  A mix of both is reasonable. Roth contributions provide
  tax diversification. Traditional contributions provide
  immediate tax relief.

  If your marginal rate is 32%+, traditional gives you
  significant immediate savings.
  If your marginal rate is 22-24%, Roth may be better
  long-term (lock in the lower rate now).

Step 4: Roth IRA

The Roth IRA offers tax-free growth and tax-free withdrawals in retirement. The 2025 contribution limit is $7,000.

Income limits apply:

Roth IRA Income Limits (2025, Single):
  Full contribution:    MAGI under $150,000
  Partial contribution: MAGI $150,000-$165,000
  Not eligible:         MAGI above $165,000

Most senior engineers exceed this limit.
Solution: Backdoor Roth IRA.

The Backdoor Roth IRA

The backdoor Roth IRA is a legal workaround for high-income earners:

Step 1: Contribute $7,000 to a Traditional IRA (non-deductible)
Step 2: Convert the Traditional IRA to a Roth IRA
Step 3: Pay tax on any gains between contribution and conversion
        (if done quickly, gains are near-zero)

Important: This only works cleanly if you have NO existing
pre-tax Traditional IRA balance. If you do, the "pro-rata rule"
applies and part of your conversion will be taxable.

Solution for pro-rata: Roll existing Traditional IRA balance
into your employer's 401k before doing the backdoor conversion.

Capital Gains vs Ordinary Income

How your investment income is taxed depends on how long you held the asset:

Short-term capital gains (held < 1 year):
  Taxed as ordinary income (your marginal rate: 22-37%)

Long-term capital gains (held >= 1 year):
  Taxed at preferential rates:
  $0-$48,350:        0%
  $48,351-$533,400:  15%
  $533,401+:         20%

Plus: 3.8% Net Investment Income Tax (NIIT) if MAGI > $200k

Example:
  You buy stock for $10,000. It grows to $15,000.
  Gain: $5,000.

  Sold after 6 months (short-term):
  Tax: $5,000 * 32% = $1,600 (at 32% marginal rate)

  Sold after 13 months (long-term):
  Tax: $5,000 * 15% = $750 (long-term rate)
  Plus NIIT: $5,000 * 3.8% = $190
  Total: $940

  Difference: $660 saved by waiting 7 months.

The practical rule: don't sell investments you've held for less than a year unless you have a compelling reason. The tax penalty for short-term gains is substantial.

Tax-Loss Harvesting

Tax-loss harvesting is selling investments at a loss to offset capital gains:

Scenario:
  You sold Stock A for a $20,000 gain (long-term)
  You hold Stock B which is down $8,000

  Without harvesting:
  Tax on $20,000 gain at 15%: $3,000

  With harvesting (sell Stock B):
  Net gain: $20,000 - $8,000 = $12,000
  Tax on $12,000 gain at 15%: $1,800
  Tax savings: $1,200

  After selling Stock B, buy a similar (but not identical)
  fund to maintain your market exposure.

Important rules:

Wash sale rule:
  You cannot buy a "substantially identical" security within
  30 days before or after selling at a loss. If you do, the
  loss is disallowed.

  Allowed: Sell VTSAX, buy SWTSX (different fund, same market)
  Not allowed: Sell VTSAX, buy VTSAX 15 days later

Excess losses:
  If your losses exceed your gains, you can deduct up to
  $3,000 of losses against ordinary income per year.
  Remaining losses carry forward to future years.

Most robo-advisors (Wealthfront, Betterment) do automated tax-loss harvesting. If you self-manage, do it manually at least once a year, typically in December.

Charitable Giving

If you make charitable donations, there are tax-efficient ways to give:

Option 1: Cash donation
  Donate $5,000 cash. Deduct $5,000 if you itemize.
  Tax savings at 32%: $1,600.
  Only useful if total deductions > standard deduction.

Option 2: Donate appreciated stock
  You hold stock with $5,000 in gains (cost basis $3,000,
  current value $8,000).
  Donate the stock directly to the charity.
  You deduct the full $8,000 market value.
  You avoid paying capital gains tax on the $5,000 gain.
  Tax savings: $8,000 * 32% = $2,560 (deduction)
              + $5,000 * 15% = $750 (avoided capital gains)
  Total benefit: $3,310.

Option 3: Donor-Advised Fund (DAF)
  Contribute appreciated stock to a DAF (Fidelity, Schwab,
  Vanguard all offer them).
  Take the deduction this year.
  Distribute to charities whenever you want (no deadline).
  Useful for: "bunching" donations in a single year to
  exceed the standard deduction threshold.

Bunching Strategy

If your annual charitable giving is 8,000butthestandarddeductionis8,000 but the standard deduction is 15,000, you get no tax benefit from your donations (because you can't itemize). Instead:

Year 1: Donate $24,000 to a DAF (3 years of giving)
        SALT deduction: $10,000
        Charitable deduction: $24,000
        Total itemized: $34,000 (exceeds $15,000 standard)
        Tax benefit realized.

Year 2: Take standard deduction ($15,000)
        Distribute from DAF to charities as desired.

Year 3: Take standard deduction ($15,000)
        Distribute from DAF to charities as desired.

Year 4: Repeat the bunching cycle.

The Standard Deduction vs Itemizing

For most engineers who rent, the standard deduction wins:

When to take the standard deduction:
  - You rent (no mortgage interest deduction)
  - Your SALT is under $10,000
  - You make small or no charitable contributions
  - You have no significant medical expenses

When to consider itemizing:
  - You own a home with a mortgage
  - You make large charitable contributions
  - You have medical expenses exceeding 7.5% of AGI
  - Your total itemized deductions exceed $15,000 (single)
    or $30,000 (married)

Most single, renting engineers: standard deduction.
Most married homeowners with charitable giving: run the numbers.

Common Pitfalls

  • Not maxing the 401k match. This is a guaranteed 50-100% return on your contribution (depending on match structure). No investment will beat free money.
  • Using the HSA as a spending account. The optimal strategy is to invest HSA funds and let them grow. Pay medical expenses out of pocket and reimburse yourself decades later when the tax-free growth has compounded.
  • Ignoring the backdoor Roth. High-income engineers who skip the backdoor Roth because "it seems complicated" are missing $7,000/year of tax-free growth space. It takes 30 minutes to set up.
  • Selling investments before the 1-year mark. Short-term capital gains are taxed at your marginal income rate (potentially 32-37%). Long-term gains are taxed at 15-20%. Patience saves thousands.
  • Donating cash instead of appreciated stock. If you have appreciated securities and plan to donate, donate the stock directly. You avoid capital gains tax and still get the full deduction.
  • Ignoring tax-loss harvesting. Free tax savings that require minimal effort. Check your portfolio in December and harvest losses against gains.
  • Over-optimizing. Some tax strategies require significant complexity (trusts, offshore structures, conservation easements). For most engineers, the basics — 401k, HSA, Roth, long-term gains, loss harvesting — capture 90% of the available benefit. Don't overcomplicate things.

Key Takeaways

  • Follow the hierarchy: 401k match first, then HSA, then full 401k, then Roth IRA (backdoor if needed), then taxable brokerage.
  • The HSA is the best tax-advantaged account in America. Triple tax advantage. Max it, invest it, don't spend it.
  • Hold investments for at least one year to qualify for long-term capital gains rates (15%) instead of ordinary income rates (up to 37%).
  • Harvest tax losses in December to offset gains. Watch the wash sale rule.
  • Donate appreciated stock instead of cash. Use a donor-advised fund for bunching if you want to itemize some years and take the standard deduction in others.
  • The basics — pre-tax deductions, long-term holding, loss harvesting — cover 90% of tax optimization. Don't chase exotic strategies.