Skip to content

Instantly share code, notes, and snippets.

@avar
Last active August 15, 2024 15:13
Show Gist options
  • Save avar/1277841 to your computer and use it in GitHub Desktop.
Save avar/1277841 to your computer and use it in GitHub Desktop.
Calculate your income in The Netherlands with and without a 30% ruling.
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything
# newer there.
#
# I make no guarantees that any of this is correct. I calculated this
# at the time and have been updating it when new tax rates come along
# because people keep finding this useful.
#
# There's also an interactive JS version of this created by
# @stevermeister at
# https://github.com/stevermeister/dutch-tax-income-calculator
# although the two seem to show conflicting values and I have no idea
# which one is correct...
use strict;
use warnings;
use Text::TabularDisplay;
use List::Util qw(sum);
my $start = 30_000 || $ARGV[0];
my $end = 200_000 || $ARGV[1];
my $step = 1_000 || $ARGV[2];
my @data;
for ( my $salary = $start ; $salary <= $end ; $salary += $step ) {
push @data => [
# Your Gross income
eurofy($salary),
# Without 30% ruling
eurofy( $salary - taxes_for($salary) ),
percentify( taxes_for($salary), $salary ),
# With 30% ruling
eurofy( $salary - taxes_for( $salary * .7 ) ),
percentify( taxes_for( $salary * .7 ), $salary ),
];
}
my $table = Text::TabularDisplay->new(
"Gross income\n(before taxes)",
"Net income\n(after taxes)",
"Tax rate",
"Net income\n(after taxes,\nwith 30% ruling)",
"Tax rate",
);
$table->add(@$_) for @data;
print $table->render, "\n";
exit;
sub taxes_for {
my $income = shift;
my @tax_brackets = (
# difference tax rate
[ 19_922 => .3655 ],
[ 66_421 - 19_922 => .4040 ],
[ 0 => .52 ],
);
my $money_left = $income;
my $taxes = 0;
foreach my $bracket (@tax_brackets) {
my ( $progressive_amount, $taxes_for ) = @$bracket;
my $taxable_amount = $money_left;
if ( $taxable_amount > $progressive_amount ) {
$taxable_amount = $progressive_amount if $progressive_amount;
}
$money_left -= $taxable_amount;
$taxes += $taxable_amount * $taxes_for;
last unless $money_left;
}
return $taxes;
}
# From perlfaq5
sub commify {
local $_ = shift;
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}
sub percentify {
my ( $amount, $total ) = @_;
return sprintf "%.1f%%" => ( ( 100 * $amount ) / $total );
}
sub eurofy {
my ($number) = @_;
# Round it
$number = int $number;
return sprintf( "%s EUR", commify($number) );
}
__DATA__
$ perl 30-income-calculon.pl
+----------------+---------------+----------+------------------+----------+
| Gross income | Net income | Tax rate | Net income | Tax rate |
| (before taxes) | (after taxes) | | (after taxes, | |
| | | | with 30% ruling) | |
+----------------+---------------+----------+------------------+----------+
| 30,000 EUR | 18,646 EUR | 37.8% | 22,282 EUR | 25.7% |
| 31,000 EUR | 19,242 EUR | 37.9% | 23,000 EUR | 25.8% |
| 32,000 EUR | 19,838 EUR | 38.0% | 23,717 EUR | 25.9% |
| 33,000 EUR | 20,434 EUR | 38.1% | 24,434 EUR | 26.0% |
| 34,000 EUR | 21,030 EUR | 38.1% | 25,151 EUR | 26.0% |
| 35,000 EUR | 21,626 EUR | 38.2% | 25,868 EUR | 26.1% |
| 36,000 EUR | 22,222 EUR | 38.3% | 26,586 EUR | 26.1% |
| 37,000 EUR | 22,818 EUR | 38.3% | 27,303 EUR | 26.2% |
| 38,000 EUR | 23,414 EUR | 38.4% | 28,020 EUR | 26.3% |
| 39,000 EUR | 24,010 EUR | 38.4% | 28,737 EUR | 26.3% |
| 40,000 EUR | 24,606 EUR | 38.5% | 29,454 EUR | 26.4% |
| 41,000 EUR | 25,202 EUR | 38.5% | 30,172 EUR | 26.4% |
| 42,000 EUR | 25,798 EUR | 38.6% | 30,889 EUR | 26.5% |
| 43,000 EUR | 26,394 EUR | 38.6% | 31,606 EUR | 26.5% |
| 44,000 EUR | 26,990 EUR | 38.7% | 32,323 EUR | 26.5% |
| 45,000 EUR | 27,586 EUR | 38.7% | 33,040 EUR | 26.6% |
| 46,000 EUR | 28,182 EUR | 38.7% | 33,758 EUR | 26.6% |
| 47,000 EUR | 28,778 EUR | 38.8% | 34,475 EUR | 26.6% |
| 48,000 EUR | 29,374 EUR | 38.8% | 35,192 EUR | 26.7% |
| 49,000 EUR | 29,970 EUR | 38.8% | 35,909 EUR | 26.7% |
| 50,000 EUR | 30,566 EUR | 38.9% | 36,626 EUR | 26.7% |
| 51,000 EUR | 31,162 EUR | 38.9% | 37,344 EUR | 26.8% |
| 52,000 EUR | 31,758 EUR | 38.9% | 38,061 EUR | 26.8% |
| 53,000 EUR | 32,354 EUR | 39.0% | 38,778 EUR | 26.8% |
| 54,000 EUR | 32,950 EUR | 39.0% | 39,495 EUR | 26.9% |
| 55,000 EUR | 33,546 EUR | 39.0% | 40,212 EUR | 26.9% |
| 56,000 EUR | 34,142 EUR | 39.0% | 40,930 EUR | 26.9% |
| 57,000 EUR | 34,738 EUR | 39.1% | 41,647 EUR | 26.9% |
| 58,000 EUR | 35,334 EUR | 39.1% | 42,364 EUR | 27.0% |
| 59,000 EUR | 35,930 EUR | 39.1% | 43,081 EUR | 27.0% |
| 60,000 EUR | 36,526 EUR | 39.1% | 43,798 EUR | 27.0% |
| 61,000 EUR | 37,122 EUR | 39.1% | 44,516 EUR | 27.0% |
| 62,000 EUR | 37,718 EUR | 39.2% | 45,233 EUR | 27.0% |
| 63,000 EUR | 38,314 EUR | 39.2% | 45,950 EUR | 27.1% |
| 64,000 EUR | 38,910 EUR | 39.2% | 46,667 EUR | 27.1% |
| 65,000 EUR | 39,506 EUR | 39.2% | 47,384 EUR | 27.1% |
| 66,000 EUR | 40,102 EUR | 39.2% | 48,102 EUR | 27.1% |
| 67,000 EUR | 40,631 EUR | 39.4% | 48,819 EUR | 27.1% |
| 68,000 EUR | 41,111 EUR | 39.5% | 49,536 EUR | 27.2% |
| 69,000 EUR | 41,591 EUR | 39.7% | 50,253 EUR | 27.2% |
| 70,000 EUR | 42,071 EUR | 39.9% | 50,970 EUR | 27.2% |
| 71,000 EUR | 42,551 EUR | 40.1% | 51,688 EUR | 27.2% |
| 72,000 EUR | 43,031 EUR | 40.2% | 52,405 EUR | 27.2% |
| 73,000 EUR | 43,511 EUR | 40.4% | 53,122 EUR | 27.2% |
| 74,000 EUR | 43,991 EUR | 40.6% | 53,839 EUR | 27.2% |
| 75,000 EUR | 44,471 EUR | 40.7% | 54,556 EUR | 27.3% |
| 76,000 EUR | 44,951 EUR | 40.9% | 55,274 EUR | 27.3% |
| 77,000 EUR | 45,431 EUR | 41.0% | 55,991 EUR | 27.3% |
| 78,000 EUR | 45,911 EUR | 41.1% | 56,708 EUR | 27.3% |
| 79,000 EUR | 46,391 EUR | 41.3% | 57,425 EUR | 27.3% |
| 80,000 EUR | 46,871 EUR | 41.4% | 58,142 EUR | 27.3% |
| 81,000 EUR | 47,351 EUR | 41.5% | 58,860 EUR | 27.3% |
| 82,000 EUR | 47,831 EUR | 41.7% | 59,577 EUR | 27.3% |
| 83,000 EUR | 48,311 EUR | 41.8% | 60,294 EUR | 27.4% |
| 84,000 EUR | 48,791 EUR | 41.9% | 61,011 EUR | 27.4% |
| 85,000 EUR | 49,271 EUR | 42.0% | 61,728 EUR | 27.4% |
| 86,000 EUR | 49,751 EUR | 42.1% | 62,446 EUR | 27.4% |
| 87,000 EUR | 50,231 EUR | 42.3% | 63,163 EUR | 27.4% |
| 88,000 EUR | 50,711 EUR | 42.4% | 63,880 EUR | 27.4% |
| 89,000 EUR | 51,191 EUR | 42.5% | 64,597 EUR | 27.4% |
| 90,000 EUR | 51,671 EUR | 42.6% | 65,314 EUR | 27.4% |
| 91,000 EUR | 52,151 EUR | 42.7% | 66,032 EUR | 27.4% |
| 92,000 EUR | 52,631 EUR | 42.8% | 66,749 EUR | 27.4% |
| 93,000 EUR | 53,111 EUR | 42.9% | 67,466 EUR | 27.5% |
| 94,000 EUR | 53,591 EUR | 43.0% | 68,183 EUR | 27.5% |
| 95,000 EUR | 54,071 EUR | 43.1% | 68,891 EUR | 27.5% |
| 96,000 EUR | 54,551 EUR | 43.2% | 69,527 EUR | 27.6% |
| 97,000 EUR | 55,031 EUR | 43.3% | 70,163 EUR | 27.7% |
| 98,000 EUR | 55,511 EUR | 43.4% | 70,799 EUR | 27.8% |
| 99,000 EUR | 55,991 EUR | 43.4% | 71,435 EUR | 27.8% |
| 100,000 EUR | 56,471 EUR | 43.5% | 72,071 EUR | 27.9% |
| 101,000 EUR | 56,951 EUR | 43.6% | 72,707 EUR | 28.0% |
| 102,000 EUR | 57,431 EUR | 43.7% | 73,343 EUR | 28.1% |
| 103,000 EUR | 57,911 EUR | 43.8% | 73,979 EUR | 28.2% |
| 104,000 EUR | 58,391 EUR | 43.9% | 74,615 EUR | 28.3% |
| 105,000 EUR | 58,871 EUR | 43.9% | 75,251 EUR | 28.3% |
| 106,000 EUR | 59,351 EUR | 44.0% | 75,887 EUR | 28.4% |
| 107,000 EUR | 59,831 EUR | 44.1% | 76,523 EUR | 28.5% |
| 108,000 EUR | 60,311 EUR | 44.2% | 77,159 EUR | 28.6% |
| 109,000 EUR | 60,791 EUR | 44.2% | 77,795 EUR | 28.6% |
| 110,000 EUR | 61,271 EUR | 44.3% | 78,431 EUR | 28.7% |
| 111,000 EUR | 61,751 EUR | 44.4% | 79,067 EUR | 28.8% |
| 112,000 EUR | 62,231 EUR | 44.4% | 79,703 EUR | 28.8% |
| 113,000 EUR | 62,711 EUR | 44.5% | 80,339 EUR | 28.9% |
| 114,000 EUR | 63,191 EUR | 44.6% | 80,975 EUR | 29.0% |
| 115,000 EUR | 63,671 EUR | 44.6% | 81,611 EUR | 29.0% |
| 116,000 EUR | 64,151 EUR | 44.7% | 82,247 EUR | 29.1% |
| 117,000 EUR | 64,631 EUR | 44.8% | 82,883 EUR | 29.2% |
| 118,000 EUR | 65,111 EUR | 44.8% | 83,519 EUR | 29.2% |
| 119,000 EUR | 65,591 EUR | 44.9% | 84,155 EUR | 29.3% |
| 120,000 EUR | 66,071 EUR | 44.9% | 84,791 EUR | 29.3% |
| 121,000 EUR | 66,551 EUR | 45.0% | 85,427 EUR | 29.4% |
| 122,000 EUR | 67,031 EUR | 45.1% | 86,063 EUR | 29.5% |
| 123,000 EUR | 67,511 EUR | 45.1% | 86,699 EUR | 29.5% |
| 124,000 EUR | 67,991 EUR | 45.2% | 87,335 EUR | 29.6% |
| 125,000 EUR | 68,471 EUR | 45.2% | 87,971 EUR | 29.6% |
| 126,000 EUR | 68,951 EUR | 45.3% | 88,607 EUR | 29.7% |
| 127,000 EUR | 69,431 EUR | 45.3% | 89,243 EUR | 29.7% |
| 128,000 EUR | 69,911 EUR | 45.4% | 89,879 EUR | 29.8% |
| 129,000 EUR | 70,391 EUR | 45.4% | 90,515 EUR | 29.8% |
| 130,000 EUR | 70,871 EUR | 45.5% | 91,151 EUR | 29.9% |
| 131,000 EUR | 71,351 EUR | 45.5% | 91,787 EUR | 29.9% |
| 132,000 EUR | 71,831 EUR | 45.6% | 92,423 EUR | 30.0% |
| 133,000 EUR | 72,311 EUR | 45.6% | 93,059 EUR | 30.0% |
| 134,000 EUR | 72,791 EUR | 45.7% | 93,695 EUR | 30.1% |
| 135,000 EUR | 73,271 EUR | 45.7% | 94,331 EUR | 30.1% |
| 136,000 EUR | 73,751 EUR | 45.8% | 94,967 EUR | 30.2% |
| 137,000 EUR | 74,231 EUR | 45.8% | 95,603 EUR | 30.2% |
| 138,000 EUR | 74,711 EUR | 45.9% | 96,239 EUR | 30.3% |
| 139,000 EUR | 75,191 EUR | 45.9% | 96,875 EUR | 30.3% |
| 140,000 EUR | 75,671 EUR | 45.9% | 97,511 EUR | 30.3% |
| 141,000 EUR | 76,151 EUR | 46.0% | 98,147 EUR | 30.4% |
| 142,000 EUR | 76,631 EUR | 46.0% | 98,783 EUR | 30.4% |
| 143,000 EUR | 77,111 EUR | 46.1% | 99,419 EUR | 30.5% |
| 144,000 EUR | 77,591 EUR | 46.1% | 100,055 EUR | 30.5% |
| 145,000 EUR | 78,071 EUR | 46.2% | 100,691 EUR | 30.6% |
| 146,000 EUR | 78,551 EUR | 46.2% | 101,327 EUR | 30.6% |
| 147,000 EUR | 79,031 EUR | 46.2% | 101,963 EUR | 30.6% |
| 148,000 EUR | 79,511 EUR | 46.3% | 102,599 EUR | 30.7% |
| 149,000 EUR | 79,991 EUR | 46.3% | 103,235 EUR | 30.7% |
| 150,000 EUR | 80,471 EUR | 46.4% | 103,871 EUR | 30.8% |
| 151,000 EUR | 80,951 EUR | 46.4% | 104,507 EUR | 30.8% |
| 152,000 EUR | 81,431 EUR | 46.4% | 105,143 EUR | 30.8% |
| 153,000 EUR | 81,911 EUR | 46.5% | 105,779 EUR | 30.9% |
| 154,000 EUR | 82,391 EUR | 46.5% | 106,415 EUR | 30.9% |
| 155,000 EUR | 82,871 EUR | 46.5% | 107,051 EUR | 30.9% |
| 156,000 EUR | 83,351 EUR | 46.6% | 107,687 EUR | 31.0% |
| 157,000 EUR | 83,831 EUR | 46.6% | 108,323 EUR | 31.0% |
| 158,000 EUR | 84,311 EUR | 46.6% | 108,959 EUR | 31.0% |
| 159,000 EUR | 84,791 EUR | 46.7% | 109,595 EUR | 31.1% |
| 160,000 EUR | 85,271 EUR | 46.7% | 110,231 EUR | 31.1% |
| 161,000 EUR | 85,751 EUR | 46.7% | 110,867 EUR | 31.1% |
| 162,000 EUR | 86,231 EUR | 46.8% | 111,503 EUR | 31.2% |
| 163,000 EUR | 86,711 EUR | 46.8% | 112,139 EUR | 31.2% |
| 164,000 EUR | 87,191 EUR | 46.8% | 112,775 EUR | 31.2% |
| 165,000 EUR | 87,671 EUR | 46.9% | 113,411 EUR | 31.3% |
| 166,000 EUR | 88,151 EUR | 46.9% | 114,047 EUR | 31.3% |
| 167,000 EUR | 88,631 EUR | 46.9% | 114,683 EUR | 31.3% |
| 168,000 EUR | 89,111 EUR | 47.0% | 115,319 EUR | 31.4% |
| 169,000 EUR | 89,591 EUR | 47.0% | 115,955 EUR | 31.4% |
| 170,000 EUR | 90,071 EUR | 47.0% | 116,591 EUR | 31.4% |
| 171,000 EUR | 90,551 EUR | 47.0% | 117,227 EUR | 31.4% |
| 172,000 EUR | 91,031 EUR | 47.1% | 117,863 EUR | 31.5% |
| 173,000 EUR | 91,511 EUR | 47.1% | 118,499 EUR | 31.5% |
| 174,000 EUR | 91,991 EUR | 47.1% | 119,135 EUR | 31.5% |
| 175,000 EUR | 92,471 EUR | 47.2% | 119,771 EUR | 31.6% |
| 176,000 EUR | 92,951 EUR | 47.2% | 120,407 EUR | 31.6% |
| 177,000 EUR | 93,431 EUR | 47.2% | 121,043 EUR | 31.6% |
| 178,000 EUR | 93,911 EUR | 47.2% | 121,679 EUR | 31.6% |
| 179,000 EUR | 94,391 EUR | 47.3% | 122,315 EUR | 31.7% |
| 180,000 EUR | 94,871 EUR | 47.3% | 122,951 EUR | 31.7% |
| 181,000 EUR | 95,351 EUR | 47.3% | 123,587 EUR | 31.7% |
| 182,000 EUR | 95,831 EUR | 47.3% | 124,223 EUR | 31.7% |
| 183,000 EUR | 96,311 EUR | 47.4% | 124,859 EUR | 31.8% |
| 184,000 EUR | 96,791 EUR | 47.4% | 125,495 EUR | 31.8% |
| 185,000 EUR | 97,271 EUR | 47.4% | 126,131 EUR | 31.8% |
| 186,000 EUR | 97,751 EUR | 47.4% | 126,767 EUR | 31.8% |
| 187,000 EUR | 98,231 EUR | 47.5% | 127,403 EUR | 31.9% |
| 188,000 EUR | 98,711 EUR | 47.5% | 128,039 EUR | 31.9% |
| 189,000 EUR | 99,191 EUR | 47.5% | 128,675 EUR | 31.9% |
| 190,000 EUR | 99,671 EUR | 47.5% | 129,311 EUR | 31.9% |
| 191,000 EUR | 100,151 EUR | 47.6% | 129,947 EUR | 32.0% |
| 192,000 EUR | 100,631 EUR | 47.6% | 130,583 EUR | 32.0% |
| 193,000 EUR | 101,111 EUR | 47.6% | 131,219 EUR | 32.0% |
| 194,000 EUR | 101,591 EUR | 47.6% | 131,855 EUR | 32.0% |
| 195,000 EUR | 102,071 EUR | 47.7% | 132,491 EUR | 32.1% |
| 196,000 EUR | 102,551 EUR | 47.7% | 133,127 EUR | 32.1% |
| 197,000 EUR | 103,031 EUR | 47.7% | 133,763 EUR | 32.1% |
| 198,000 EUR | 103,511 EUR | 47.7% | 134,399 EUR | 32.1% |
| 199,000 EUR | 103,991 EUR | 47.7% | 135,035 EUR | 32.1% |
| 200,000 EUR | 104,471 EUR | 47.8% | 135,671 EUR | 32.2% |
+----------------+---------------+----------+------------------+----------+
@koraykupe
Copy link

koraykupe commented Jun 30, 2017

How income taxes is calculated?

Let's assume that taxable income is 37000

2017 Total rate is 36.55% up to € 19,982
and 40.80% for € 19,982 to € 67,072

Is the tax amount 37000 * 40.80 = 15.096 or (19982*36.55) + (37000-19982)*40.80 = 7303 + 6943 = 14.246?

and how is personal tax credit and Labour tax credit calculated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment