Lesson 3: Tax-Efficient Investing & Retirement Accounts
Maximize your after-tax returns by understanding tax-advantaged accounts, tax-loss harvesting, and asset location strategies.
Why Tax Efficiency Matters
A dollar saved in taxes is a dollar earned — tax-free. Smart tax planning can add 1-2% to your annual returns, which compounds to a massive difference over decades.
Mental model: Think of taxes as a leak in your investment bucket — the smaller the leak, the more water (money) you keep.
The Power of Tax-Deferred Growth
| Scenario | Annual Return | Taxes (25%) | After-Tax Return | 30-Year Value ($10,000) |
|---|---|---|---|---|
| Taxable Account | 8% | 2% | 6% | $57,435 |
| Tax-Deferred (401k/IRA) | 8% | 0% | 8% | $100,627 |
| Roth IRA | 8% | 0% | 8% | $100,627 (tax-free) |
Tax-deferred growth nearly doubles your money over 30 years!
Retirement Account Types
Traditional vs. Roth Accounts
| Feature | Traditional 401k/IRA | Roth 401k/IRA |
|---|---|---|
| Contributions | Pre-tax (reduces taxable income now) | After-tax (no deduction now) |
| Growth | Tax-deferred | Tax-free |
| Withdrawals | Taxed as ordinary income | Tax-free (if qualified) |
| Best When | Higher tax bracket now | Lower tax bracket now |
| Required Distributions | Yes, at age 73 | No RMDs for original owner |
Contribution Limits (2024)
| Account | Under 50 | 50 and Over |
|---|---|---|
| 401(k) | $23,000 | $30,500 |
| Traditional/Roth IRA | $7,000 | $8,000 |
| SEP IRA | $69,000 | $69,000 |
| HSA | $4,150 (individual) | $4,150 + $1,000 catch-up |
The Order of Operations for Tax Efficiency
Follow this priority list to maximize tax benefits:
| Priority | Account | Why First |
|---|---|---|
| 1 | 401(k) up to employer match | Free money — 100% instant return |
| 2 | HSA (if eligible) | Triple tax advantage |
| 3 | Roth IRA (if eligible) | Tax-free growth and withdrawals |
| 4 | 401(k) up to maximum | Additional tax-deferred growth |
| 5 | Taxable brokerage | Only after maxing tax-advantaged |
Asset Location Strategy
Where you hold investments matters as much as what you hold:
| Asset Type | Best Location | Why |
|---|---|---|
| Bonds/Fixed Income | Tax-deferred (401k/IRA) | Interest taxed as ordinary income |
| High-Growth Stocks | Roth IRA | Tax-free appreciation |
| Dividend Stocks | Tax-deferred | Dividends taxed less in retirement |
| Index Funds | Taxable brokerage | Low turnover, tax-efficient |
| REITs | Tax-deferred | Dividends taxed as ordinary income |
Key insight: Put your most tax-inefficient investments in tax-advantaged accounts and your most tax-efficient investments in taxable accounts.
Tax-Loss Harvesting
Selling investments at a loss to offset gains and reduce taxes.
How It Works
| Step | Action | Tax Impact |
|---|---|---|
| 1 | Sell losing investment | Realize $5,000 loss |
| 2 | Offset gains | Reduce taxable gains by $5,000 |
| 3 | Extra losses | Up to $3,000 can offset ordinary income |
| 4 | Carry forward | Unused losses carry to future years |
| 5 | Repurchase | Buy similar (not identical) investment |
Tax-Loss Harvesting Rules
| Rule | Explanation |
|---|---|
| Wash Sale Rule | Can't buy "substantially identical" security within 30 days |
| $3,000 Limit | Can only deduct $3,000 of losses against ordinary income per year |
| Long-term vs. Short-term | Long-term losses offset long-term gains first |
| Carry Forward | Unused losses carry forward indefinitely |
Capital Gains Tax Rates
| Holding Period | Tax Rate | Example |
|---|---|---|
| Short-term (< 1 year) | Ordinary income rates (10-37%) | $50,000 gain taxed at 22% = $11,000 |
| Long-term (> 1 year) | 0%, 15%, or 20% | $50,000 gain taxed at 15% = $7,500 |
Holding for at least 1 year saves you thousands in taxes!
Long-Term Capital Gains Brackets (2024)
| Filing Status | 0% Rate | 15% Rate | 20% Rate |
|---|---|---|---|
| Single | Up to $47,025 | $47,025 - $518,900 | Over $518,900 |
| Married Filing Jointly | Up to $94,050 | $94,050 - $583,750 | Over $583,750 |
Common Tax Mistakes to Avoid
- Mistake: Not maximizing employer 401(k) match — Fix: Always contribute enough to get the full match — it's free money.
- Mistake: Holding investments for less than 1 year — Fix: Be patient; long-term rates are much lower.
- Mistake: Ignoring asset location — Fix: Put tax-inefficient assets in tax-advantaged accounts.
- Mistake: Not tax-loss harvesting — Fix: Review your portfolio quarterly for harvesting opportunities.
Professional Tips & Tricks
- Use tax-loss harvesting software (Wealthfront, Betterment) to automate the process.
- Don't let the tax tail wag the investment dog — good investments beat tax optimization.
- Consider a backdoor Roth IRA if you exceed income limits.
- Work with a tax professional for complex situations.
Key Takeaways
- Tax-deferred accounts can nearly double your money over 30 years.
- Follow the order of operations: 401(k) match → HSA → Roth IRA → 401(k) max → Taxable.
- Asset location matters: put tax-inefficient assets in tax-advantaged accounts.
- Tax-loss harvesting can save thousands in taxes each year.
- Hold investments for at least 1 year to qualify for lower long-term capital gains rates.
Next up: Behavioral finance — understanding and overcoming the psychology that derails investors.
# Tax-Efficient Investing Cheat Sheet
## Account Priority Order
1. 401(k) up to employer match (FREE MONEY!)
2. HSA (Triple tax advantage)
3. Roth IRA (Tax-free growth)
4. 401(k) to maximum
5. Taxable brokerage
## Asset Location Guide
| Asset Type | Best Account |
|------------|--------------|
| Bonds/Fixed Income | 401(k)/IRA |
| High-Growth Stocks | Roth IRA |
| Dividend Stocks | 401(k)/IRA |
| Index Funds | Taxable Brokerage |
| REITs | 401(k)/IRA |
## Tax-Loss Harvesting Rules
✓ Sell losing positions to offset gains
✓ Up to $3,000 losses offset ordinary income
✓ Unused losses carry forward indefinitely
✗ Don't buy same security within 30 days (Wash Sale)
## Capital Gains Tax Rates
| Holding Period | Tax Rate |
|----------------|----------|
| < 1 year | 10-37% |
| > 1 year | 0-20% |
## 30-Year Tax Impact ($10,000 at 8%)
| Account Type | After-Tax Value |
|--------------|-----------------|
| Taxable | $57,435 |
| Tax-Deferred | $100,627 |
| Roth | $100,627 |
Difference: $43,192 (75% more with tax advantage!)Lesson Code (Python)
# Tax-Efficient Investing Cheat Sheet
## Account Priority Order
1. 401(k) up to employer match (FREE MONEY!)
2. HSA (Triple tax advantage)
3. Roth IRA (Tax-free growth)
4. 401(k) to maximum
5. Taxable brokerage
## Asset Location Guide
| Asset Type | Best Account |
|------------|--------------|
| Bonds/Fixed Income | 401(k)/IRA |
| High-Growth Stocks | Roth IRA |
| Dividend Stocks | 401(k)/IRA |
| Index Funds | Taxable Brokerage |
| REITs | 401(k)/IRA |
## Tax-Loss Harvesting Rules
✓ Sell losing positions to offset gains
✓ Up to $3,000 losses offset ordinary income
✓ Unused losses carry forward indefinitely
✗ Don't buy same security within 30 days (Wash Sale)
## Capital Gains Tax Rates
| Holding Period | Tax Rate |
|----------------|----------|
| < 1 year | 10-37% |
| > 1 year | 0-20% |
## 30-Year Tax Impact ($10,000 at 8%)
| Account Type | After-Tax Value |
|--------------|-----------------|
| Taxable | $57,435 |
| Tax-Deferred | $100,627 |
| Roth | $100,627 |
Difference: $43,192 (75% more with tax advantage!)Console Output
# Tax-Efficient Investing Cheat Sheet
## Account Priority Order
1. 401(k) up to employer match (FREE MONEY!)
2. HSA (Triple tax advantage)
3. Roth IRA (Tax-free growth)
4. 401(k) to maximum
5. Taxable brokerage
## Asset Location Guide
| Asset Type | Best Account |
|------------|--------------|
| Bonds/Fixed Income | 401(k)/IRA |
| High-Growth Stocks | Roth IRA |
| Dividend Stocks | 401(k)/IRA |
| Index Funds | Taxable Brokerage |
| REITs | 401(k)/IRA |
## Tax-Loss Harvesting Rules
✓ Sell losing positions to offset gains
✓ Up to $3,000 losses offset ordinary income
✓ Unused losses carry forward indefinitely
✗ Don't buy same security within 30 days (Wash Sale)
## Capital Gains Tax Rates
| Holding Period | Tax Rate |
|----------------|----------|
| < 1 year | 10-37% |
| > 1 year | 0-20% |
## 30-Year Tax Impact ($10,000 at 8%)
| Account Type | After-Tax Value |
|--------------|-----------------|
| Taxable | $57,435 |
| Tax-Deferred | $100,627 |
| Roth | $100,627 |
Difference: $43,192 (75% more with tax advantage!)Code Visualization Tips
- Compare the growth of $10,000 in taxable vs. tax-deferred accounts over 30 years.
- Map out which investments go in which accounts using the asset location guide.
- Calculate your current tax savings from maximizing 401(k) contributions.
Professional Tips & Tricks
- Always contribute enough to get the full 401(k) match — it's an instant 100% return.
- Use tax-loss harvesting software to automate the process.
- Consider a backdoor Roth IRA if you exceed income limits.
Python Code Judge & Practice Arena
LeetCode StyleRun real Python 3.12 WebAssembly code directly in your browser against automated test suites.
Account Selection Exercise
Up next · Continue learning
Behavioral Finance — The Psychology of Investing
Understand the cognitive biases that cause investors to make irrational decisions and learn strategies to overcome them.