-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfire.html
More file actions
513 lines (473 loc) · 30.4 KB
/
fire.html
File metadata and controls
513 lines (473 loc) · 30.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FIRE Calculator</title>
<script type="text/javascript">
var weeksPerYear = 52;
var vacationWeeks = 5;
var workdaysPerWeek = 5;
var workHoursPerDay = 8;
var workHoursPerYear = (weeksPerYear-vacationWeeks)*workdaysPerWeek*workHoursPerDay;
window.addEventListener("load", (loadedEvent) => {
console.log("page is fully loaded");
resetAmounts();
document.getElementById('assets_withdrawal_spendable_amount_per_year')
.addEventListener("input", (spendableInputEvent) => {
calculateFromDesiredExpenses();
}
);
document.getElementById('assets_withdrawal_spendable_amount_per_month').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_spendable_amount_per_year').value = parseFromElement(inputEvent.target) * 12.0;
calculateFromDesiredExpenses();
});
document.getElementById('assets_withdrawal_spendable_amount_per_week').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_spendable_amount_per_year').value = parseFromElement(inputEvent.target) * 52.0;
calculateFromDesiredExpenses();
});
document.getElementById('assets_withdrawal_spendable_amount_per_day').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_spendable_amount_per_year').value = parseFromElement(inputEvent.target) * 365.0;
calculateFromDesiredExpenses();
});
// document.getElementById('assets_withdrawal_spendable_amount_per_hour').
// addEventListener('input', (inputEvent) => {
// document.getElementById('assets_withdrawal_spendable_amount_per_year').value = parseFromElement(inputEvent.target) * workHoursPerYear;
// calculateFromDesiredExpenses();
// });
document.getElementById('assets_withdrawal_rate_per_year').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('tax_rate_fortune_tax').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('tax_fortune_tax_zero_bracket_cutoff').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('primary_residence_market_value').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('primary_residence_fortune_tax_value_reduction_first_bracket').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('primary_residence_fortune_tax_first_bracket_cutoff').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('primary_residence_fortune_tax_value_reduction_second_bracket').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('tax_rate_property_tax').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('other_assets_value').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('tax_rate_capital_gains').
addEventListener('input', (inputEvent) => {
calculateFromDesiredExpenses();
});
document.getElementById('assets_withdrawal_amount_per_year').
addEventListener('input', (inputEvent) => {
calculateFromTotalWithdrawn();
});
document.getElementById('assets_withdrawal_amount_per_month').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_amount_per_year').value = parseFromElement(inputEvent.target) * 12.0;
calculateFromTotalWithdrawn();
});
document.getElementById('assets_withdrawal_amount_per_week').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_amount_per_year').value = parseFromElement(inputEvent.target) * 52.0;
calculateFromTotalWithdrawn();
});
document.getElementById('assets_withdrawal_amount_per_day').
addEventListener('input', (inputEvent) => {
document.getElementById('assets_withdrawal_amount_per_year').value = parseFromElement(inputEvent.target) * 365.0;
calculateFromTotalWithdrawn();
});
// document.getElementById('assets_withdrawal_amount_per_hour').
// addEventListener('input', (inputEvent) => {
// document.getElementById('assets_withdrawal_amount_per_year').value = parseFromElement(inputEvent.target) * workHoursPerYear;
// calculateFromTotalWithdrawn();
// });
document.getElementById('liquid_assets_amount').
addEventListener('input', (inputEvent) => {
var liquidAssets = parseFromElement(inputEvent.target);
var annualWithdrawalRate = parseFromElement(document.getElementById('assets_withdrawal_rate_per_year')) / 100.0;
var annualWithdrawal = liquidAssets * annualWithdrawalRate;
console.log(`AW: ${annualWithdrawal}`);
document.getElementById('assets_withdrawal_amount_per_year').value = annualWithdrawal;
calculateFromTotalWithdrawn();
});
});
function calculateFromDesiredExpenses()
{
var desiredAnnualExpenses = parseFromElement(document.getElementById('assets_withdrawal_spendable_amount_per_year'));
// liquid assets = (desired spending amount + fortune tax rate * (home value - deduction percentage) + fortune tax rate * other illiquid assets + property tax rate * home value)/(withdrawal rate - fortune tax rate - withdrawal rate * capital gains tax rate)
var annualWithdrawalRate = parseFromElement(document.getElementById('assets_withdrawal_rate_per_year')) / 100.0;
var fortuneTaxRate = parseFromElement(document.getElementById('tax_rate_fortune_tax')) / 100.0;
var fortuneTaxZeroRateCutoff = parseFromElement(document.getElementById('tax_fortune_tax_zero_bracket_cutoff'));
var otherAssetsValue = parseFromElement(document.getElementById('other_assets_value'));
var capitalGainsTaxRate = parseFromElement(document.getElementById('tax_rate_capital_gains')) / 100.0;
var liquidAssetsCalculated = 0.0;
var noFortuneTaxLiquidAssets = (desiredAnnualExpenses + GetHomePropertyTax()) / (annualWithdrawalRate * (1.0 - capitalGainsTaxRate));
if(noFortuneTaxLiquidAssets + GetHomeFortuneTaxValuation() + otherAssetsValue <= fortuneTaxZeroRateCutoff) {
liquidAssetsCalculated = noFortuneTaxLiquidAssets;
}
else
{
liquidAssetsCalculated = (fortuneTaxRate * (GetHomeFortuneTaxValuation() + otherAssetsValue - fortuneTaxZeroRateCutoff) + desiredAnnualExpenses + GetHomePropertyTax()) / (annualWithdrawalRate - annualWithdrawalRate * capitalGainsTaxRate - fortuneTaxRate);
}
document.getElementById('liquid_assets_amount').value = roundNumber(liquidAssetsCalculated, 0);
updateWithdrawalTotal();
updateSpending();
formatAmounts();
}
function calculateFromTotalWithdrawn()
{
var annualWithdrawnAmount = parseFromElement(document.getElementById('assets_withdrawal_amount_per_year'));
var annualWithdrawalRate = parseFromElement(document.getElementById('assets_withdrawal_rate_per_year')) / 100.0;
var liquidAssets = annualWithdrawnAmount / annualWithdrawalRate;
document.getElementById('liquid_assets_amount').value = roundNumber(liquidAssets, 2);
var annualWithdrawalRate = parseFromElement(document.getElementById('assets_withdrawal_rate_per_year')) / 100.0;
var fortuneTaxRate = parseFromElement(document.getElementById('tax_rate_fortune_tax')) / 100.0;
var fortuneTaxZeroRateCutoff = parseFromElement(document.getElementById('tax_fortune_tax_zero_bracket_cutoff'));
var otherAssetsValue = parseFromElement(document.getElementById('other_assets_value'));
var capitalGainsTaxRate = parseFromElement(document.getElementById('tax_rate_capital_gains')) / 100.0;
var leftForSpending = annualWithdrawnAmount - (fortuneTaxRate * Math.max(0, liquidAssets + GetHomeFortuneTaxValuation() + otherAssetsValue - fortuneTaxZeroRateCutoff) + GetHomePropertyTax() + capitalGainsTaxRate * annualWithdrawnAmount);
document.getElementById('assets_withdrawal_spendable_amount_per_year').value = roundNumber(leftForSpending, 2);
updateSpending();
updateWithdrawalTotal();
formatAmounts();
}
function GetHomeFortuneTaxValuation() {
var homeValue = parseFromElement(document.getElementById('primary_residence_market_value'));
var firstBracketCutoff = parseFromElement(document.getElementById('primary_residence_fortune_tax_first_bracket_cutoff'));
var firstBracketValuationReduction = parseFromElement(document.getElementById('primary_residence_fortune_tax_value_reduction_first_bracket')) / 100.0;
if(homeValue <= firstBracketCutoff) {
return homeValue * (1.0 - firstBracketValuationReduction);
}
var secondBracketValuationReduction = parseFromElement(document.getElementById('primary_residence_fortune_tax_value_reduction_second_bracket')) / 100.0;
return firstBracketCutoff * (1.0 - firstBracketValuationReduction) + (homeValue - firstBracketCutoff) * (1.0 - secondBracketValuationReduction);
}
function GetHomePropertyTax() {
var homeValue = parseFromElement(document.getElementById('primary_residence_market_value'));
var propertyTaxRate = parseFromElement(document.getElementById('tax_rate_property_tax')) / 100.0;
return homeValue * propertyTaxRate;
}
function updateWithdrawalTotal()
{
var liquidAssets = parseFromElement(document.getElementById('liquid_assets_amount'));
var annualWithdrawalRate = parseFromElement(document.getElementById('assets_withdrawal_rate_per_year')) / 100.0;
var annualWithdrawal = liquidAssets * annualWithdrawalRate;
document.getElementById('assets_withdrawal_amount_per_year').value = roundNumber(annualWithdrawal, 2);
document.getElementById('assets_withdrawal_amount_per_month').value = roundNumber(annualWithdrawal / 12.0, 2);
document.getElementById('assets_withdrawal_amount_per_week').value = roundNumber(annualWithdrawal / 52.0, 2);
document.getElementById('assets_withdrawal_amount_per_day').value = roundNumber(annualWithdrawal / 365.0, 2);
// document.getElementById('assets_withdrawal_amount_per_hour').value = roundNumber(annualWithdrawal / workHoursPerYear, 2);
}
function updateSpending()
{
var annualSpending = parseFromElement(document.getElementById('assets_withdrawal_spendable_amount_per_year'));
document.getElementById('assets_withdrawal_spendable_amount_per_month').value = roundNumber(annualSpending / 12.0, 2);
document.getElementById('assets_withdrawal_spendable_amount_per_week').value = roundNumber(annualSpending / 52.0, 2);
document.getElementById('assets_withdrawal_spendable_amount_per_day').value = roundNumber(annualSpending / 365.0, 2);
// document.getElementById('assets_withdrawal_spendable_amount_per_hour').value = roundNumber(annualSpending / workHoursPerYear, 2);
}
function formatAmounts(){
var amountElements = document.getElementsByTagName('input');
for (var i = 0; i < amountElements.length; i++) {
// console.log(`Formatted: ${formatForPrint(parseFromPrint(amountElements[i].value))}`);
// amountElements[i].value = parseFloat(amountElements[i].value).toLocaleString("no");
if(1000 <= parseFromPrint(amountElements[i].value.replace(/-/,'')))
amountElements[i].value = formatForPrint(parseFromPrint(amountElements[i].value));
}
}
function resetAmounts(){
var amountElements = document.getElementsByTagName('input');
for (var i = 0; i < amountElements.length; i++) {
var resetValue = 0;
if(amountElements[i].getAttribute('data-original-amount') > 0.0)
{
resetValue = amountElements[i].getAttribute('data-original-amount');
}
amountElements[i].value = resetValue;
}
calculateFromDesiredExpenses();
}
// All changes trigger change in assets_withdrawal_spendable_amount_per_year, trigger change of everything else
function roundNumber(number, decimalPlaces) {
return +(Math.round(number + "e+" + decimalPlaces) + "e-" + decimalPlaces);
}
function formatForPrint(number)
{
const n = String(number),
p = n.indexOf('.');
return n.replace(
/\d(?=(?:\d{3})+(?:\.|$))/g,
(m, i) => p < 0 || i < p ? `${m} ` : m
);
}
function parseFromPrint(formattedNumberString)
{
return parseFloat(formattedNumberString.replace(/\s/g,''));
}
function parseFromElement(element)
{
var numberString = parseFromPrint(element.value);
if(isNaN(numberString)) return 0;
return numberString;
}
</script>
<style>
/* body {
margin: 2rem;
} */
/* h1 {
font-size: 12pt;
} */
label {
padding-right: 0.5rem;
}
input {
max-height: 1rem;
}
.input-group input {
width: 5rem;
text-align: right;
}
.two-columns {
/* display: grid; */
grid-template-columns: 2fr 1fr;
min-width: 16rem;
max-width: 17rem;
}
.two-columns > .input-group {
display: grid;
grid-template-columns: inherit;
/* position: relative;
width: 100%; */
}
#form_container {
display: grid;
/* max-width: 100%; */
/* grid-template-columns: repeat(auto-fit, minmax(16rem, 18rem)); */
/* align-items: center; */
grid-template-columns: repeat(auto-fit, minmax(20rem, 2fr));
}
.three-colum-long-start > .input-group {
display: grid;
/* grid-template-columns: inherit; */
grid-template-columns: minmax(8rem, 27rem) 6rem;
/* position: relative;
width: 100%; */
}
/* .read-more {
margin-left: 0.5rem;
} */
.three-column-balanced > .input-group {
display: grid;
grid-template-columns: 13rem 6rem;
/* justify-items: left; */
max-width: 35rem;
}
.three-column-long-end > .input-group {
display: grid;
grid-template-columns: minmax(5rem, 13rem) 6rem;
}
.three-column-assets > .input-group {
display: grid;
grid-template-columns: minmax(5rem, 16rem) 6rem;
}
.withdrawal-container {
display: grid;
/* grid-template-columns: auto auto; */
grid-template-columns: repeat(auto-fit, minmax(16rem, 18rem));
/* grid-template-columns: repeat(auto-fit, auto-fit); */
}
.withdrawal-container fieldset legend:first-of-type {
height: 2rem;
margin-bottom: 0.5rem;
line-height: 90%;
display: grid;
align-items: center;
align-self: center;
place-self: center;
/* justify-content: flex-end;
align-items: flex-end; */
}
/* .withdrawal-container > .read-more {
flex: 0 0 100%;
} */
#liquid_assets_fieldset > .input-group{
display: grid;
grid-template-columns: 9rem 6rem;
/* max-width: 17rem; */
}
button {
grid-column: 1;
max-height: 2rem;
}
</style>
</head>
<body>
<h1>FIRE Norway Calculator</h1>
<div id="form_container">
<fieldset class="withdrawal-container">
<legend>Withdrawal from liquid assets</legend>
<fieldset class="two-columns">
<legend>Spendable Amount</legend>
<div class="input-group">
<label for="assets_withdrawal_spendable_amount_per_year">Amount per year</label>
<input id="assets_withdrawal_spendable_amount_per_year" value="150000" data-original-amount="150000" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_spendable_amount_per_month">Amount per month</label>
<input id="assets_withdrawal_spendable_amount_per_month" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_spendable_amount_per_week">Amount per week</label>
<input id="assets_withdrawal_spendable_amount_per_week" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_spendable_amount_per_day">Amount per day</label>
<input id="assets_withdrawal_spendable_amount_per_day" inputmode="numeric" pattern="[0-9 \.]">
</div>
</fieldset>
<fieldset class="two-columns">
<legend>Total Amount (including amount to pay taxes)</legend>
<div class="input-group">
<label for="assets_withdrawal_amount_per_year">Amount per year</label>
<input id="assets_withdrawal_amount_per_year" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_amount_per_month">Amount per month</label>
<input id="assets_withdrawal_amount_per_month" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_amount_per_week">Amount per week</label>
<input id="assets_withdrawal_amount_per_week" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="assets_withdrawal_amount_per_day">Amount per day</label>
<input id="assets_withdrawal_amount_per_day" inputmode="numeric" pattern="[0-9 \.]">
</div>
</fieldset>
</fieldset>
<fieldset class="three-column-assets">
<legend>Assets</legend>
<fieldset id="liquid_assets_fieldset">
<legend>Liquid Assets</legend>
<div class="input-group">
<label for="liquid_assets_amount">Value</label>
<input id="liquid_assets_amount">
</div>
<div class="input-group input-percentage">
<label for="assets_withdrawal_rate_per_year">Withdrawal rate per year (%)</label>
<input id="assets_withdrawal_rate_per_year" value="3" data-original-amount="3" type="number" step="0.1">
</div>
</fieldset>
<div class="input-group">
<label for="primary_residence_market_value">Primary residence market value</label>
<input id="primary_residence_market_value" value="4814968" data-original-amount="4814968" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group">
<label for="other_assets_value">Other illiquid assets value</label>
<input id="other_assets_value" value="0" inputmode="numeric" pattern="[0-9 \.]">
</div>
</fieldset>
<fieldset class="three-column-long-end">
<legend>Taxes</legend>
<div class="input-group input-percentage">
<label for="tax_rate_capital_gains">Capital gains tax rate (%)</label>
<input id="tax_rate_capital_gains" value="37.84" data-original-amount="37.84" type="number">
</div>
<div class="input-group">
<label for="tax_rate_property_tax">Property tax rate (%)</label>
<input id="tax_rate_property_tax" value="0.4" data-original-amount="0.4" step="0.01" type="number">
</div>
<fieldset class="three-column-balanced">
<legend>Fortune tax</legend>
<div class="input-group input-percentage">
<label for="tax_rate_fortune_tax">Fortune tax rate (%)</label>
<input id="tax_rate_fortune_tax" value="1.1" data-original-amount="1.1" step="0.1" type="number">
</div>
<div class="input-group">
<label for="tax_fortune_tax_zero_bracket_cutoff">Fortune tax zero bracket</label>
<input id="tax_fortune_tax_zero_bracket_cutoff" value="1700000" data-original-amount="1700000" step="100000" inputmode="numeric" pattern="[0-9 \.]">
</div>
<fieldset class="three-colum-long-start">
<legend>Primary residence fortune tax valuation</legend>
<div class="input-group input-percentage">
<label for="primary_residence_fortune_tax_value_reduction_first_bracket">Tax value reduction for fortune tax (%) first bracket</label>
<input id="primary_residence_fortune_tax_value_reduction_first_bracket" value="75" data-original-amount="75" type="number">
</div>
<div class="input-group">
<label for="primary_residence_fortune_tax_first_bracket_cutoff">Fortune tax home value first bracket cutoff</label>
<input id="primary_residence_fortune_tax_first_bracket_cutoff" value="10000000" data-original-amount="10000000" inputmode="numeric" pattern="[0-9 \.]">
</div>
<div class="input-group input-percentage">
<label for="primary_residence_fortune_tax_value_reduction_second_bracket">Tax value reduction for fortune tax (%) second bracket</label>
<input id="primary_residence_fortune_tax_value_reduction_second_bracket" value="30" data-original-amount="30" type="number">
</div>
</fieldset>
</fieldset>
</fieldset>
<br>
<button onclick="resetAmounts()">Reset</button>
</div>
<h1>About</h1>
<p>I occasionally catch myself wondering, what would it take to effectively just retire? I know that there isn't that much math to it, but it's slightly more tricky than I can quickly ballpark in my head and be satisfied with the answer. Especially with the fortune tax requiring you to constantly withdraw a small amount of you assets, which triggers additional taxes on the realized gains, and so on. This could probably have been a spreadsheet, but it's more fun this way (and accessible with regards to keeping the code/logic up to date, and sharable if others would want to play with it).</p>
<p>It is heavily oriented towards Norway, because that's where I live.</p>
<p>Also note that the tax rules are more complex, and this only gives a quick overview. However, it's mostly based around worst case scenarios with no deductions and similar.</p>
<h2>Resources</h2>
<ul>
<li><a href="https://www.oslomet.no/om/sifo/referansebudsjettet">Reference budget calculator</a></li>
<li><a href="https://www.skatteetaten.no/satser/faktor-for-oppjustering-av-gevinsttap-eller-utbytte-pa-aksjer/">Capital gains tax rate</a> 2024: 37.84% for stocks, 22% for other sources.</li>
<li><a href="https://eiendomnorge.no/boligprisstatistikk/">Average home price</a></li>
<li><a href="https://www.ssb.no/bygg-bolig-og-eiendom/faktaside/bolig">General housing statistics</a></li>
<li><a href="https://www.skatteetaten.no/person/skatt/hjelp-til-riktig-skatt/bolig-og-eiendeler/bolig-eiendom-tomt/eiendomsskatt/hvor-mye-skatt-ma-jeg-betale/">Property tax rates</a></li>
<li><a href="https://www.skatteetaten.no/satser/formuesskatt/">Fortune tax rates and deductions</a></li>
<li><a href="https://www.skatteetaten.no/person/skatt/hjelp-til-riktig-skatt/verdsettingsrabatt-ved-fastsetting-av-formue/">Property valuation for fortune tax</a></li>
</ul>
<h2>Flaws</h2>
<p>The major shortcomings I'm aware of</p>
<ul>
<li>The capital gains tax is only 1.0 percent up til 20 000 000, it's only after that it's 1.1%. At the moment, I just can't be bothered implementing it. Just adjust the value in the field if you want more accuracy for a lower bracket</li>
<li>Not all municipalities take their part of the fortune taxes (though these are pathological cases).</li>
<li>The property tax is based on the highest legal rate, based on the property market value. Most municipalities run with a discounted valuation for primary residences, and few charge the highest rate.</li>
<li>The calculation assumes all liquid assets are in stocks. Ideally it should support a mixture with other asset classes where capital gains are taxed at the lower 22% rate.</li>
</ul>
<h2>The math behind</h2>
<p>Here is the calculation this is based on</p>
<p>(Annual) withdrawal = desired spending amount + taxes = liquid assets * withdrawal rate</p>
<p>The below is outdated, but I'm leaving it until I find the motivation to clean it up</p>
<p>taxes = fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets - zero bracket cutoff) + property tax rate * home value + amount withdrawn * capital gains tax rate</p>
<p>(Annual) withdrawal = liquid assets * withdrawal rate = desired spending amount + (fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets - zero bracket cutoff) + property tax rate * home value + amount withdrawn * capital gains tax rate)</p>
<p>(Annual) withdrawal = liquid assets * withdrawal rate = desired spending amount + fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets- zero bracket cutoff) + property tax rate * home value + (liquid assets * withdrawal rate) * capital gains tax rate</p>
<p>Solved for liquid assets</p>
<p>liquid assets * withdrawal rate = desired spending amount + fortune tax rate * liquid assets + fortune tax rate * (home value - deduction percentage) + fortune tax rate * other illiquid assets - fortune tax rate * zero bracket cutoff + property tax rate * home value + liquid assets * withdrawal rate * capital gains tax rate</p>
<p>taxes = fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets) + property tax rate * home value + amount withdrawn * capital gains tax rate</p>
<p>(Annual) withdrawal = liquid assets * withdrawal rate = desired spending amount + (fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets) + property tax rate * home value + amount withdrawn * capital gains tax rate)</p>
<p>(Annual) withdrawal = liquid assets * withdrawal rate = desired spending amount + fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets) + property tax rate * home value + (liquid assets * withdrawal rate) * capital gains tax rate</p>
<p>Solved for liquid assets</p>
<p>liquid assets * withdrawal rate = desired spending amount + fortune tax rate * liquid assets + fortune tax rate * (home value - deduction percentage) + fortune tax rate * other illiquid assets + property tax rate * home value + liquid assets * withdrawal rate * capital gains tax rate</p>
<p>liquid assets * withdrawal rate - fortune tax rate * liquid assets - liquid assets * withdrawal rate * capital gains tax rate = desired spending amount + fortune tax rate * (home value - deduction percentage) + fortune tax rate * other illiquid assets + property tax rate * home value</p>
<p>liquid assets = (desired spending amount + fortune tax rate * (home value - deduction percentage) + fortune tax rate * other illiquid assets + property tax rate * home value)/(withdrawal rate - fortune tax rate - withdrawal rate * capital gains tax rate)</p>
<p>Solved for spending amount</p>
<p>(Annual) withdrawal = liquid assets * withdrawal rate = desired spending amount + fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets) + property tax rate * home value + (liquid assets * withdrawal rate) * capital gains tax rate</p>
<p>desired spending amount = liquid assets * withdrawal rate - (fortune tax rate * (liquid assets + (home value - deduction percentage) + other illiquid assets) + property tax rate * home value + (liquid assets * withdrawal rate) * capital gains tax rate)</p>
</body>
</html>