-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroth-vs-traditional.html
More file actions
773 lines (728 loc) · 39.8 KB
/
Copy pathroth-vs-traditional.html
File metadata and controls
773 lines (728 loc) · 39.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- SEO Meta Tags -->
<title>Roth vs Traditional IRA Calculator | Compare Tax Advantages 2025</title>
<meta name="description" content="Free Roth vs Traditional IRA calculator. Compare tax benefits, calculate which retirement account saves you more money. See the difference between Roth and Traditional IRA with our free comparison tool.">
<meta name="keywords" content="Roth vs Traditional IRA, IRA calculator, Roth IRA calculator, Traditional IRA calculator, retirement account calculator, IRA comparison calculator, Roth vs Traditional calculator, retirement tax calculator, IRA tax calculator, which IRA is better, Roth IRA vs 401k">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://fireplanner.org/roth-vs-traditional.html">
<!-- Open Graph -->
<meta property="og:title" content="Roth vs Traditional IRA Calculator - Compare Retirement Accounts">
<meta property="og:description" content="Compare Roth IRA vs Traditional IRA tax advantages. Free calculator shows which saves you more money.">
<meta property="og:url" content="https://fireplanner.org/roth-vs-traditional.html">
<meta property="og:image" content="https://fireplanner.org/android-chrome-512x512.png">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-B0FS8F3KDN"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-B0FS8F3KDN');
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2955475775322391"
crossorigin="anonymous"></script>
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<title>Roth vs Traditional IRA Calculator | FIRE Planner</title>
<meta name="description" content="Compare Roth IRA vs Traditional IRA and find which retirement account saves you more money. Free calculator with tax comparison.">
<!-- Prevent flash of wrong theme -->
<script>
(function(){
var K='fireplanner-theme',D=document.documentElement;
var t;try{t=localStorage.getItem(K)}catch(e){}
if(t!=='dark'&&t!=='light')t=window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light';
D.setAttribute('data-theme',t);
window.toggleFPTheme=function(){
var c=D.getAttribute('data-theme')==='dark'?'light':'dark';
D.setAttribute('data-theme',c);
try{localStorage.setItem(K,c)}catch(e){}
};
})();
</script>
<link rel="stylesheet" href="styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Work+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
<script>
/* ── FIRE Planner Utilities ── */
/* =====================================================
FIRE PLANNER — Core Utilities (loads early in <head>)
animateValue, FPValidate, FPShare, FPSteps
All defined on window so inline scripts can call them
===================================================== */
/* ---- Animated number counter ---- */
window.animateValue = function(el, newText, duration) {
if (!el) return;
duration = duration || 600;
var numMatch = newText.match(/[\d,]+\.?\d*/);
if (!numMatch) { el.textContent = newText; return; }
var targetNum = parseFloat(numMatch[0].replace(/,/g, ''));
var prefix = newText.slice(0, newText.indexOf(numMatch[0]));
var suffix = newText.slice(newText.indexOf(numMatch[0]) + numMatch[0].length);
var curMatch = el.textContent.match(/[\d,]+\.?\d*/);
var startNum = curMatch ? parseFloat(curMatch[0].replace(/,/g, '')) : 0;
if (startNum === targetNum) { el.textContent = newText; return; }
var startTime = performance.now();
var isCurrency = prefix.indexOf('$') !== -1 || newText.indexOf('$') === 0;
function step(now) {
var progress = Math.min((now - startTime) / duration, 1);
var ease = 1 - Math.pow(1 - progress, 3);
var current = startNum + (targetNum - startNum) * ease;
if (isCurrency) {
el.textContent = new Intl.NumberFormat('en-US', {
style: 'currency', currency: 'USD',
minimumFractionDigits: 0, maximumFractionDigits: 0
}).format(Math.round(current)) + suffix;
} else {
el.textContent = prefix + Math.round(current).toLocaleString('en-US') + suffix;
}
if (progress < 1) requestAnimationFrame(step);
else el.textContent = newText;
}
requestAnimationFrame(step);
};
/* ---- Input validation engine ---- */
window.FPValidate = {
rules: {},
init: function(rules) {
this.rules = rules;
var self = this;
Object.keys(rules).forEach(function(id) {
var el = document.getElementById(id);
if (!el) return;
var wrap = el.closest('.form-group');
if (!wrap) return;
if (!document.getElementById('err-' + id)) {
var err = document.createElement('div');
err.className = 'fp-error-msg';
err.id = 'err-' + id;
err.innerHTML = '<span>⚠</span><span class="fp-err-text"></span>';
wrap.appendChild(err);
}
el.addEventListener('blur', function() { self.check(id); });
el.addEventListener('input', function() {
if (el.classList.contains('fp-invalid')) self.check(id);
else self.checkValid(id);
});
});
},
check: function(id) {
var el = document.getElementById(id);
var rule = this.rules[id];
if (!el || !rule) return true;
var val = parseFloat(el.value);
var err = document.getElementById('err-' + id);
var msg = '';
if (el.value === '' || isNaN(val)) {
msg = (rule.label || 'This field') + ' is required.';
} else if (rule.min !== undefined && val < rule.min) {
msg = 'Enter at least ' + rule.min + (rule.unit || '.');
} else if (rule.max !== undefined && val > rule.max) {
msg = 'Maximum is ' + rule.max + (rule.unit || '.');
} else if (rule.custom) {
msg = rule.custom(val, el) || '';
}
if (msg) {
el.classList.add('fp-invalid'); el.classList.remove('fp-valid');
if (err) { err.querySelector('.fp-err-text').textContent = msg; err.classList.add('visible'); }
return false;
} else {
el.classList.remove('fp-invalid'); el.classList.add('fp-valid');
if (err) err.classList.remove('visible');
return true;
}
},
checkValid: function(id) {
var el = document.getElementById(id);
var rule = this.rules[id];
if (!el || !rule) return;
var val = parseFloat(el.value);
if (!isNaN(val) && (rule.min === undefined || val >= rule.min) && (rule.max === undefined || val <= rule.max)) {
el.classList.remove('fp-invalid'); el.classList.add('fp-valid');
var err = document.getElementById('err-' + id);
if (err) err.classList.remove('visible');
}
},
checkAll: function() {
var self = this;
return Object.keys(this.rules).every(function(id) { return self.check(id); });
}
};
/* ---- Share / canvas card generator ---- */
window.FPShare = {
open: function(title, results) {
var modal = document.getElementById('fp-share-modal');
if (!modal) { this._createModal(); modal = document.getElementById('fp-share-modal'); }
this._drawCard(title, results);
modal.classList.add('open');
},
_createModal: function() {
var el = document.createElement('div');
el.className = 'fp-modal-overlay';
el.id = 'fp-share-modal';
el.innerHTML =
'<div class="fp-modal">' +
'<h3>📤 Share Your Results</h3>' +
'<p>Download your results card to share on Instagram, Reddit, or with friends.</p>' +
'<div class="fp-share-card-preview"><canvas id="fp-share-canvas" width="800" height="450"></canvas></div>' +
'<div class="fp-modal-actions">' +
'<button class="fp-modal-download" onclick="FPShare.download()">↓ Download Image</button>' +
'<button class="fp-modal-close" onclick="FPShare.close()">Close</button>' +
'</div></div>';
document.body.appendChild(el);
el.addEventListener('click', function(e) { if (e.target === el) FPShare.close(); });
},
_drawCard: function(title, results) {
var canvas = document.getElementById('fp-share-canvas');
var ctx = canvas.getContext('2d');
var w = 800, h = 450;
var bg = ctx.createLinearGradient(0, 0, w, h);
bg.addColorStop(0, '#1a2332'); bg.addColorStop(1, '#2c3e5f');
ctx.fillStyle = bg; ctx.fillRect(0, 0, w, h);
var r1 = ctx.createRadialGradient(w*.8, h*.2, 0, w*.8, h*.2, 280);
r1.addColorStop(0, 'rgba(255,107,53,0.20)'); r1.addColorStop(1, 'transparent');
ctx.fillStyle = r1; ctx.fillRect(0, 0, w, h);
var r2 = ctx.createRadialGradient(w*.1, h*.8, 0, w*.1, h*.8, 200);
r2.addColorStop(0, 'rgba(37,99,235,0.20)'); r2.addColorStop(1, 'transparent');
ctx.fillStyle = r2; ctx.fillRect(0, 0, w, h);
ctx.fillStyle = 'rgba(255,255,255,0.88)';
ctx.font = 'bold 17px sans-serif';
ctx.fillText('\uD83D\uDD25 FIRE Planner \u00B7 fireplanner.org', 48, 50);
ctx.strokeStyle = 'rgba(255,255,255,0.14)'; ctx.lineWidth = 1;
ctx.beginPath(); ctx.moveTo(48, 65); ctx.lineTo(w-48, 65); ctx.stroke();
ctx.fillStyle = '#fff'; ctx.font = 'bold 32px serif';
ctx.fillText(title, 48, 108);
var cols = Math.min(results.length, 4);
var cardW = (w - 96 - (cols-1)*14) / cols;
var sy = 136;
var colors = ['#ff6b35','#2563eb','#059669','#d97706'];
results.slice(0, cols).forEach(function(r, i) {
var x = 48 + i*(cardW+14);
ctx.fillStyle = 'rgba(255,255,255,0.07)';
_rrect(ctx, x, sy, cardW, 118, 10); ctx.fill();
ctx.fillStyle = colors[i]; _rrect(ctx, x, sy, cardW, 4, 2); ctx.fill();
ctx.fillStyle = 'rgba(255,255,255,0.52)';
ctx.font = '600 11px sans-serif';
ctx.fillText(r.label.toUpperCase().slice(0,22), x+14, sy+28);
ctx.fillStyle = '#fff';
ctx.font = 'bold ' + (r.value.length > 10 ? '20' : '26') + 'px serif';
ctx.fillText(r.value, x+14, sy+74);
});
ctx.fillStyle = 'rgba(255,255,255,0.32)'; ctx.font = '12px sans-serif';
ctx.fillText('fireplanner.org \u00B7 For educational purposes only. Not financial advice.', 48, h-22);
},
download: function() {
var canvas = document.getElementById('fp-share-canvas');
var a = document.createElement('a');
a.download = 'fire-planner-results.png';
a.href = canvas.toDataURL('image/png');
a.click();
},
close: function() {
var modal = document.getElementById('fp-share-modal');
if (modal) modal.classList.remove('open');
}
};
function _rrect(ctx, x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x+r,y); ctx.lineTo(x+w-r,y);
ctx.quadraticCurveTo(x+w,y,x+w,y+r); ctx.lineTo(x+w,y+h-r);
ctx.quadraticCurveTo(x+w,y+h,x+w-r,y+h); ctx.lineTo(x+r,y+h);
ctx.quadraticCurveTo(x,y+h,x,y+h-r); ctx.lineTo(x,y+r);
ctx.quadraticCurveTo(x,y,x+r,y); ctx.closePath();
}
/* ---- Multi-step wizard ---- */
window.FPSteps = {
current: 0, total: 0,
init: function(total, stepNames) {
this.total = total; this.current = 0;
this._renderBar(stepNames); this._show(0);
},
_renderBar: function(names) {
var bar = document.getElementById('fp-steps-bar');
if (!bar) return;
var html = '<div class="fp-progress-track" id="fp-progress-track"></div>';
for (var i = 0; i < this.total; i++) {
html += '<div class="fp-step' + (i===0?' active':'') + '" data-step="'+i+'" onclick="FPSteps.goto('+i+')">' +
'<div class="fp-step-dot">' + (i+1) + '</div>' +
'<div class="fp-step-label">' + (names[i]||'Step '+(i+1)) + '</div></div>';
}
bar.innerHTML = html; this._updateTrack();
},
goto: function(n) {
if (n<0||n>=this.total) return;
this._hide(this.current); this.current=n;
this._show(n); this._updateBar(); this._updateTrack();
},
next: function() { this.goto(this.current+1); },
prev: function() { this.goto(this.current-1); },
_show: function(n) { var p=document.getElementById('fp-panel-'+n); if(p) p.classList.add('active'); },
_hide: function(n) { var p=document.getElementById('fp-panel-'+n); if(p) p.classList.remove('active'); },
_updateBar: function() {
document.querySelectorAll('.fp-step').forEach(function(el) {
var s=parseInt(el.getAttribute('data-step'));
el.classList.remove('active','done');
if(s===FPSteps.current) el.classList.add('active');
else if(s<FPSteps.current) el.classList.add('done');
});
},
_updateTrack: function() {
var t=document.getElementById('fp-progress-track'); if(!t) return;
t.style.width=(this.total<=1?100:(this.current/(this.total-1))*100)+'%';
}
};
</script>
<script>
/* ── FIRE Planner: Utilities (inline, no external deps) ── */
/* Format currency */
function fpFmt(v) {
return new Intl.NumberFormat('en-US',{style:'currency',currency:'USD',minimumFractionDigits:0,maximumFractionDigits:0}).format(isNaN(v)?0:v);
}
/* Animated number counter */
window.animateValue = function(el, newText) {
if (!el) return;
var numMatch = newText.match(/[\d,]+\.?\d*/);
if (!numMatch) { el.textContent = newText; return; }
var target = parseFloat(numMatch[0].replace(/,/g,''));
var prefix = newText.slice(0, newText.indexOf(numMatch[0]));
var suffix = newText.slice(newText.indexOf(numMatch[0]) + numMatch[0].length);
var curMatch = el.textContent.match(/[\d,]+\.?\d*/);
var start = curMatch ? parseFloat(curMatch[0].replace(/,/g,'')) : 0;
if (start === target) { el.textContent = newText; return; }
var t0 = performance.now();
var isCur = prefix.indexOf('$') !== -1 || newText.indexOf('$') === 0;
(function step(now) {
var p = Math.min((now-t0)/600, 1), e = 1-Math.pow(1-p,3);
var cur = start + (target-start)*e;
el.textContent = isCur
? new Intl.NumberFormat('en-US',{style:'currency',currency:'USD',minimumFractionDigits:0,maximumFractionDigits:0}).format(Math.round(cur))+suffix
: prefix+Math.round(cur).toLocaleString('en-US')+suffix;
if (p < 1) requestAnimationFrame(step); else el.textContent = newText;
})(t0);
};
/* Input validation */
window.FPValidate = {
rules:{},
init: function(rules) {
this.rules = rules; var self = this;
Object.keys(rules).forEach(function(id) {
var el = document.getElementById(id); if (!el) return;
var wrap = el.closest('.form-group'); if (!wrap) return;
if (!document.getElementById('err-'+id)) {
var err = document.createElement('div');
err.className='fp-error-msg'; err.id='err-'+id;
err.innerHTML='<span>⚠</span><span class="fp-err-text"></span>';
wrap.appendChild(err);
}
el.addEventListener('blur', function(){ self.check(id); });
el.addEventListener('input', function(){
if (el.classList.contains('fp-invalid')) self.check(id); else self.checkValid(id);
});
});
},
check: function(id) {
var el=document.getElementById(id), rule=this.rules[id];
if (!el||!rule) return true;
var val=parseFloat(el.value), err=document.getElementById('err-'+id), msg='';
if (el.value===''||isNaN(val)) msg=(rule.label||'This field')+' is required.';
else if (rule.min!==undefined&&val<rule.min) msg='Enter at least '+rule.min+(rule.unit||'.');
else if (rule.max!==undefined&&val>rule.max) msg='Maximum is '+rule.max+(rule.unit||'.');
else if (rule.custom) msg=rule.custom(val,el)||'';
if (msg) {
el.classList.add('fp-invalid'); el.classList.remove('fp-valid');
if (err){err.querySelector('.fp-err-text').textContent=msg;err.classList.add('visible');}
return false;
} else {
el.classList.remove('fp-invalid'); el.classList.add('fp-valid');
if (err) err.classList.remove('visible');
return true;
}
},
checkValid: function(id) {
var el=document.getElementById(id),rule=this.rules[id]; if(!el||!rule) return;
var val=parseFloat(el.value);
if(!isNaN(val)&&(rule.min===undefined||val>=rule.min)&&(rule.max===undefined||val<=rule.max)){
el.classList.remove('fp-invalid');el.classList.add('fp-valid');
var err=document.getElementById('err-'+id);if(err)err.classList.remove('visible');
}
}
};
/* Share card */
window.FPShare = {
open: function(title, results) {
var modal=document.getElementById('fp-share-modal');
if (!modal) { this._make(); modal=document.getElementById('fp-share-modal'); }
this._draw(title, results);
modal.classList.add('open');
},
_make: function() {
var el=document.createElement('div');
el.className='fp-modal-overlay'; el.id='fp-share-modal';
el.innerHTML='<div class="fp-modal"><h3>📤 Share Your Results</h3><p>Download your results card to share with friends.</p><div class="fp-share-card-preview"><canvas id="fp-share-canvas" width="800" height="450"></canvas></div><div class="fp-modal-actions"><button class="fp-modal-download" onclick="FPShare.download()">↓ Download Image</button><button class="fp-modal-close" onclick="FPShare.close()">Close</button></div></div>';
document.body.appendChild(el);
el.addEventListener('click',function(e){if(e.target===el)FPShare.close();});
},
_draw: function(title, results) {
var c=document.getElementById('fp-share-canvas'),ctx=c.getContext('2d'),w=800,h=450;
var bg=ctx.createLinearGradient(0,0,w,h);
bg.addColorStop(0,'#1a2332');bg.addColorStop(1,'#2c3e5f');
ctx.fillStyle=bg;ctx.fillRect(0,0,w,h);
var r1=ctx.createRadialGradient(w*.8,h*.2,0,w*.8,h*.2,280);
r1.addColorStop(0,'rgba(255,107,53,.20)');r1.addColorStop(1,'transparent');
ctx.fillStyle=r1;ctx.fillRect(0,0,w,h);
ctx.fillStyle='rgba(255,255,255,.88)';ctx.font='bold 17px sans-serif';
ctx.fillText('\uD83D\uDD25 FIRE Planner \u00B7 fireplanner.org',48,50);
ctx.strokeStyle='rgba(255,255,255,.14)';ctx.lineWidth=1;
ctx.beginPath();ctx.moveTo(48,65);ctx.lineTo(w-48,65);ctx.stroke();
ctx.fillStyle='#fff';ctx.font='bold 30px serif';ctx.fillText(title,48,105);
var cols=Math.min(results.length,4),cw=(w-96-(cols-1)*14)/cols,sy=130;
var colors=['#ff6b35','#2563eb','#059669','#d97706'];
results.slice(0,cols).forEach(function(r,i){
var x=48+i*(cw+14);
ctx.fillStyle='rgba(255,255,255,.07)';_rr(ctx,x,sy,cw,118,10);ctx.fill();
ctx.fillStyle=colors[i];_rr(ctx,x,sy,cw,4,2);ctx.fill();
ctx.fillStyle='rgba(255,255,255,.52)';ctx.font='600 11px sans-serif';
ctx.fillText(r.label.toUpperCase().slice(0,22),x+14,sy+28);
ctx.fillStyle='#fff';ctx.font='bold '+(r.value.length>10?'20':'25')+'px serif';
ctx.fillText(r.value,x+14,sy+72);
});
ctx.fillStyle='rgba(255,255,255,.30)';ctx.font='12px sans-serif';
ctx.fillText('fireplanner.org \u00B7 For educational purposes only.',48,h-22);
},
download: function(){
var a=document.createElement('a');
a.download='fire-planner-results.png';
a.href=document.getElementById('fp-share-canvas').toDataURL('image/png');
a.click();
},
close: function(){var m=document.getElementById('fp-share-modal');if(m)m.classList.remove('open');}
};
function _rr(ctx,x,y,w,h,r){
ctx.beginPath();ctx.moveTo(x+r,y);ctx.lineTo(x+w-r,y);
ctx.quadraticCurveTo(x+w,y,x+w,y+r);ctx.lineTo(x+w,y+h-r);
ctx.quadraticCurveTo(x+w,y+h,x+w-r,y+h);ctx.lineTo(x+r,y+h);
ctx.quadraticCurveTo(x,y+h,x,y+h-r);ctx.lineTo(x,y+r);
ctx.quadraticCurveTo(x,y,x+r,y);ctx.closePath();
}
/* Multi-step wizard */
window.FPSteps = {
cur:0, total:0,
init:function(total,names){this.total=total;this.cur=0;this._bar(names);this._show(0);},
_bar:function(names){
var b=document.getElementById('fp-steps-bar');if(!b)return;
var h='<div class="fp-progress-track" id="fp-progress-track"></div>';
for(var i=0;i<this.total;i++)h+='<div class="fp-step'+(i===0?' active':'')+'\" data-step="'+i+'" onclick="FPSteps.goto('+i+')"><div class="fp-step-dot">'+(i+1)+'</div><div class="fp-step-label">'+(names[i]||'Step '+(i+1))+'</div></div>';
b.innerHTML=h;this._track();
},
goto:function(n){if(n<0||n>=this.total)return;this._hide(this.cur);this.cur=n;this._show(n);this._dots();this._track();},
next:function(){this.goto(this.cur+1);},prev:function(){this.goto(this.cur-1);},
_show:function(n){var p=document.getElementById('fp-panel-'+n);if(p)p.classList.add('active');},
_hide:function(n){var p=document.getElementById('fp-panel-'+n);if(p)p.classList.remove('active');},
_dots:function(){document.querySelectorAll('.fp-step').forEach(function(el){var s=parseInt(el.dataset.step);el.classList.remove('active','done');if(s===FPSteps.cur)el.classList.add('active');else if(s<FPSteps.cur)el.classList.add('done');});},
_track:function(){var t=document.getElementById('fp-progress-track');if(t)t.style.width=(this.total<=1?100:this.cur/(this.total-1)*100)+'%';}
};
/* Zero-on-empty: call after setting up inputs */
window.fpZeroEmpty = function(selector) {
document.querySelectorAll(selector).forEach(function(inp) {
inp.addEventListener('blur', function() {
if (this.value === '' || this.value === null) this.value = '0';
});
inp.addEventListener('blur', function() {
if (this.value === '') this.value = '0';
});
});
};
</script>
</head>
<body class="calculator-page">
<header class="site-header">
<div class="container">
<div class="header-content">
<div class="logo">
<a href="index.html" style="display: flex; align-items: center; text-decoration: none; gap: 14px;">
<img src="fire-logo.png" alt="FIRE Planner" style="height: 52px; width: auto;">
<div>
<h1>FIRE Planner</h1>
<p class="tagline">Your Path to Financial Independence</p>
</div>
</a>
</div>
<nav class="main-nav">
<a href="index.html#calculators">Calculators</a>
<a href="resources.html">Resources</a>
<a href="glossary.html">Glossary</a>
<a href="about.html">About</a>
<a href="https://www.instagram.com/fireplanner_org/" target="_blank" rel="noopener" class="nav-instagram" aria-label="Follow us on Instagram">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>
</a>
<button type="button" class="theme-toggle" aria-label="Toggle dark mode" onclick="toggleFPTheme()"><span class="toggle-icon sun">☀</span><span class="toggle-icon moon">☾</span></button>
</nav>
</div>
</div>
</header>
<div class="calculator-header">
<div class="container">
<h1>⚖️ Roth vs Traditional IRA Calculator</h1>
<p>Compare which retirement account is better for your situation</p>
</div>
</div>
<section class="calculator-container">
<div class="container">
<div class="calculator-layout">
<div class="input-panel">
<h2>Your Information</h2>
<form id="ira-form">
<div class="form-group">
<div class="fp-label-wrap"><label for="annual-contribution">Annual Contribution ($)</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">2025 IRA limit: $7,000/year ($8,000 if age 50+). Consistent maxing out is one of the most powerful FIRE moves.</span></span></div>
<input type="number" id="annual-contribution" value="6500" min="0" step="500" onblur="if(this.value==='')this.value='0'">
<small style="color: #64748b; font-size: 13px; display: block; margin-top: 4px;">2024 IRA limit: $7,000 ($8,000 if 50+)</small>
</div>
<div class="form-group">
<div class="fp-label-wrap"><label for="current-age">Current Age</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">Your age today — used to calculate how many years your money will compound before retirement.</span></span></div>
<input type="number" id="current-age" value="30" min="18" max="100" step="1" onblur="if(this.value==='')this.value='0'">
</div>
<div class="form-group">
<div class="fp-label-wrap"><label for="retirement-age">Retirement Age</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">Age 59½ is when you can withdraw from IRAs penalty-free. Early FIRE withdrawers often use a Roth conversion ladder to access funds earlier.</span></span></div>
<input type="number" id="retirement-age" value="65" min="50" max="80" step="1" onblur="if(this.value==='')this.value='0'">
</div>
<div class="form-group">
<div class="fp-label-wrap"><label for="current-tax-rate">Current Tax Rate (%)</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">Your marginal tax bracket — the rate on your last dollar earned. 2024 brackets: 10%, 12%, 22%, 24%, 32%, 35%, 37%.</span></span></div>
<input type="number" id="current-tax-rate" value="24" min="0" max="50" step="1" onblur="if(this.value==='')this.value='0'">
<small style="color: #64748b; font-size: 13px; display: block; margin-top: 4px;">Your marginal tax bracket today</small>
</div>
<div class="form-group">
<div class="fp-label-wrap"><label for="retirement-tax-rate">Expected Retirement Tax Rate (%)</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">Many FIRE retirees are in a lower bracket since they control their income. If you expect to be richer, you might stay high — that favors Roth now.</span></span></div>
<input type="number" id="retirement-tax-rate" value="22" min="0" max="50" step="1" onblur="if(this.value==='')this.value='0'">
<small style="color: #64748b; font-size: 13px; display: block; margin-top: 4px;">Your expected tax bracket in retirement</small>
</div>
<div class="form-group">
<div class="fp-label-wrap"><label for="rate-of-return">Expected Annual Return (%)</label><span class="fp-tip" tabindex="0"><span class="fp-tip-bubble">Historical S&P 500 real return (~7% inflation-adjusted). Both accounts grow identically — the difference is only tax treatment.</span></span></div>
<input type="number" id="rate-of-return" value="7" min="0" max="20" step="0.5" onblur="if(this.value==='')this.value='0'">
</div>
</form>
</div>
<div class="results-panel">
<h2>Comparison Results</h2>
<div class="result-card" style="border-left-color: #059669;">
<div class="result-label">🏆 Better Option</div>
<div class="result-value" id="winner" style="font-size: 28px;">-</div>
<div class="result-subtext" id="winner-reason">Calculate to see recommendation</div>
</div>
<div class="result-card">
<div class="result-label">Traditional IRA Final Value</div>
<div class="result-value" id="traditional-value">$0</div>
<div class="result-subtext">After-tax value at retirement</div>
</div>
<div class="result-card">
<div class="result-label">Roth IRA Final Value</div>
<div class="result-value" id="roth-value">$0</div>
<div class="result-subtext">Tax-free value at retirement</div>
</div>
<div class="result-card" style="border-left-color: #d97706;">
<div class="result-label">Difference</div>
<div class="result-value" id="difference">$0</div>
<div class="result-subtext" id="difference-pct">-</div>
</div>
<div class="result-card">
<div class="result-label">Years Contributing</div>
<div class="result-value" id="years-contributing">0</div>
<div class="result-subtext" id="total-contributed">Total contributed: $0</div>
</div>
<div class="fp-share-section" style="margin-top:24px;">
<button class="fp-share-btn" onclick="fpIRAShare()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>
Share My Results
</button>
</div>
</div>
</div>
<!-- COMPARISON TABLE -->
<div class="fp-compare-section" style="max-width: var(--content-max); margin: 32px auto 0;">
<h3>Side-by-Side Comparison</h3>
<p>Key differences between Traditional and Roth IRAs</p>
<table class="fp-compare-table">
<thead>
<tr>
<th>Feature</th>
<th>Traditional IRA</th>
<th>Roth IRA</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tax on contributions</td>
<td>Pre-tax (deductible)</td>
<td>After-tax (no deduction)</td>
</tr>
<tr>
<td>Tax on withdrawals</td>
<td>Taxed as income</td>
<td class="fp-winner-cell">Tax-free ✓</td>
</tr>
<tr>
<td>2025 contribution limit</td>
<td>$7,000 / $8,000 (50+)</td>
<td>$7,000 / $8,000 (50+)</td>
</tr>
<tr>
<td>Required Minimum Distributions</td>
<td>Age 73</td>
<td class="fp-winner-cell">None ✓</td>
</tr>
<tr>
<td>Income limits</td>
<td>Deductibility phases out at high income</td>
<td>Contributions phase out ~$161K (single)</td>
</tr>
<tr>
<td>Early withdrawal (before 59½)</td>
<td>10% penalty + taxes</td>
<td>Contributions can be withdrawn anytime</td>
</tr>
<tr>
<td>Best if…</td>
<td>Tax rate is higher now than in retirement</td>
<td class="fp-winner-cell">Tax rate is lower now (young/FIRE)</td>
</tr>
<tr>
<td>FIRE friendliness</td>
<td>Good — enables Roth conversion ladder</td>
<td class="fp-winner-cell">Excellent — tax-free growth for decades</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<footer class="site-footer">
<div class="container">
<div class="footer-content">
<div class="footer-section">
<h4>FIRE Planner</h4>
<p>Free tools to help you achieve Financial Independence and Retire Early.</p>
</div>
<div class="footer-section">
<h4>Calculators</h4>
<ul>
<li><a href="fire-calculator.html">FIRE Calculator</a></li>
<li><a href="compound-interest.html">Compound Interest</a></li>
<li><a href="coast-fire-calculator.html">Coast FIRE</a></li>
<li><a href="401k-calculator.html">401k Calculator</a></li>
<li><a href="net-worth-calculator.html">Net Worth</a></li>
<li><a href="roth-vs-traditional.html">Roth vs Traditional</a></li>
<li><a href="debt-calculator.html">Debt Payoff</a></li>
<li><a href="fee-calculator.html">Investment Fees</a></li>
<li><a href="savings-goal-calculator.html">Savings Goal</a></li>
<li><a href="retirement-age-calculator.html">Retirement Age</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Resources</h4>
<ul>
<li><a href="resources.html">FIRE Resources</a></li>
<li><a href="fire-guide.html">FIRE Guide</a></li>
<li><a href="glossary.html">Glossary</a></li>
<li><a href="about.html">About Us</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Legal</h4>
<ul>
<li><a href="privacy-policy.html">Privacy Policy</a></li>
<li><a href="terms-of-service.html">Terms of Service</a></li>
<li><a href="disclaimer.html">Disclaimer</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Follow Us</h4>
<ul>
<li>
<a href="https://www.instagram.com/fireplanner_org/" target="_blank" rel="noopener" style="display: flex; align-items: center; gap: 8px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>
@fireplanner_org
</a>
</li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>© 2025 FIRE Planner. All calculators are for educational purposes. Consult a financial advisor for personalized advice.</p>
</div>
</div>
</footer>
<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
/* ── Calc ── */
function calc() {
var contrib = parseFloat(document.getElementById('annual-contribution').value) || 0;
var curAge = parseInt(document.getElementById('current-age').value) || 30;
var retAge = parseInt(document.getElementById('retirement-age').value) || 65;
var curTax = (parseFloat(document.getElementById('current-tax-rate').value) || 24) / 100;
var retTax = (parseFloat(document.getElementById('retirement-tax-rate').value) || 22) / 100;
var ret = (parseFloat(document.getElementById('rate-of-return').value) || 7) / 100;
var yrs = Math.max(0, retAge-curAge);
var tradBal=0, rothBal=0, rothAnn=contrib*(1-curTax);
for (var y=0;y<yrs;y++){tradBal=(tradBal+contrib)*(1+ret);rothBal=(rothBal+rothAnn)*(1+ret);}
var tradAfter=tradBal*(1-retTax), diff=Math.abs(rothBal-tradAfter);
var pct=tradAfter>0?(diff/Math.max(rothBal,tradAfter)*100):0;
var winner,reason;
if (diff<1000){winner="They're Equal!";reason="Both options provide similar value";}
else if(rothBal>tradAfter){winner="Roth IRA";reason="Save "+fpFmt(diff)+" more by paying taxes now";}
else{winner="Traditional IRA";reason="Save "+fpFmt(diff)+" more by deferring taxes";}
document.getElementById('winner').textContent=winner;
document.getElementById('winner-reason').textContent=reason;
animateValue(document.getElementById('traditional-value'), fpFmt(tradAfter));
animateValue(document.getElementById('roth-value'), fpFmt(rothBal));
document.getElementById('difference').textContent=fpFmt(diff);
document.getElementById('difference-pct').textContent=pct.toFixed(1)+'% difference';
document.getElementById('years-contributing').textContent=yrs+' years';
document.getElementById('total-contributed').textContent='Total contributed: '+fpFmt(contrib*yrs);
}
/* Wire all inputs in this form */
var form = document.getElementById('ira-form');
if (form) {
form.querySelectorAll('input, select').forEach(function(inp) {
inp.addEventListener('input', calc);
inp.addEventListener('change', calc);
/* Show 0 when field is cleared */
inp.addEventListener('blur', function() {
if (this.value === '' || this.value === null) { this.value = '0'; calc(); }
});
});
}
/* Zero-fill on any input across the page */
document.querySelectorAll('input[type="number"]').forEach(function(inp) {
inp.addEventListener('blur', function() {
if (this.value === '') { this.value = '0'; calc(); }
});
});
/* Validation */
FPValidate.init({
'annual-contribution': {label:'Annual contribution', min:1, max:30000},
'current-age': {label:'Current age', min:10, max:80, unit:' years'},
'retirement-age': {label:'Retirement age', min:20, max:90, unit:' years'},
'current-tax-rate': {label:'Current tax rate', min:0, max:60, unit:'%'},
'retirement-tax-rate': {label:'Retirement tax rate', min:0, max:60, unit:'%'},
'rate-of-return': {label:'Return rate', min:0, max:20, unit:'%'},
});
/* Share */
window.fpIRAShare = function() {
FPShare.open('Roth vs Traditional IRA', [{label:'Recommendation',value:document.getElementById('winner').textContent},{label:'Traditional Value',value:document.getElementById('traditional-value').textContent},{label:'Roth Value',value:document.getElementById('roth-value').textContent},{label:'Difference',value:document.getElementById('difference').textContent}]);
};
/* Run immediately */
calc();
document.querySelectorAll('input[type="number"]').forEach(function(inp) {
inp.addEventListener('focus', function() { this.select(); });
inp.addEventListener('blur', function() { if (this.value === '') { this.value = '0'; calc(); } });
});
});
</script>
</body>
</html>