From Curiosity to Code: How I Built a Python Script to Calculate Dutch Road Tax
When I was looking for a new car, I made a list of all my options and started breaking down the costs—road tax, insurance, maintenance, and fuel usage. Every time I needed to check the cost of the road tax, I turned to the Belastingdienst’s tool. But as I went back and forth between different vehicles, I began to think, There has to be a more efficient way to calculate this.
That’s when my journey into understanding and automating the calculation of Motorrijtuigenbelasting (MRB) began.
The Search for a Calculation Formula
I initially thought the road tax calculation would be straightforward, but it turned out to be much more complex than I had imagined. The Netherlands uses a tax system based on several variables, including:
- Weight of the vehicle: Heavier cars pay higher taxes.
- Fuel type: Diesel cars typically incur higher road taxes than gasoline-powered ones.
- Province you’re registered in: Each province has an additional tax surcharge called Opcenten, which varies annually.
- Inflation adjustment: The tax is adjusted every year based on inflation rate.
As I searched for an easier way to calculate this, I quickly realized there were no simple tools or calculators that provided an API or script I could use directly. I found one JavaScript library on GitHub called motorrijtuigenbelasting, which worked, but it wasn’t quite what I was looking for. It was a good starting point but didn’t offer the flexibility of running multiple calculations across different vehicles and years in Python.
Building My Own Calculator
Instead of simply using the existing library, I decided to write my own Python script. My goal was to replicate the logic of the original tool but also make it customizable so I could:
- Easily input different cars and check their road tax.
- Calculate future road tax based on inflation and province-specific changes.
- Automate everything so I could compare the tax costs for multiple vehicles with minimal effort.
The first step was to dive into the laws that are used in the calculations. Turns out these are laws from the 1990’s, one from 1994 and an update from 1995. These laws specify the exact rates, exceptions, and rules for each category, which I had to translate into code. But that was only the beginning.
Guldens to Euros: Converting Historical Data
One thing I didn’t expect was the conversion from Guldens to Euros. Since the tax rates in the laws were from the 1990s, the values were originally set in Guldens before the Euro was adopted in 2002. This meant I had to account for this historical change.
Fortunately, I found the official conversion rate (1 Euro = 2.20371 Guldens), which allowed me to work with the data as it existed before the Euro was introduced. This conversion was crucial to ensure that my calculations were accurate and historically consistent when working with the older tax tables.
Factoring in Opcenten and Inflation Adjustments
Anyone who has owned a car in the Netherlands and moved between provinces knows that the total tax you pay differs depending on your location. The difference can be substantial if you move from the cheapest to the most expensive province—or vice versa. This extra tax is called Opcenten.
Each year, each province can adjust its surcharge, so I needed to look up the current rate for the province of interest. These surcharges could vary significantly, adding another layer of complexity to the formula. Luckily, the Centraal Bureau voor de Statistiek (CBS) collects this information in a handy table, which can be found here. Unfortunately, Opcenten rates change every year, so I will need to wait until the end of each year to get the correct data for the upcoming year.
In addition to Opcenten, I also had to account for inflation adjustments. Unlike general inflation rates, the Belastingdienst publishes their own specific inflation figures each year, which are used to adjust the base road tax rates. This was another piece of the puzzle that I had to track, as the inflation figures are published late in the year—just like the Opcenten rates.
Final Thoughts
By the end of this process, I had a much deeper understanding of how Dutch road tax works—and how complex it can be. With the combination of weight, fuel type, province-specific surcharges, and inflation adjustments, the calculation is anything but simple. However, by automating this with Python, I was able to streamline the process and ensure accuracy.
This journey also taught me a lot about tax systems and how they’re designed and adjusted over time. With this program, I can now more easily compare the road tax costs for different cars and even project future tax expenses based on expected inflation and surcharges.
Development is ongoing in my repository Once I finish developing the script fully, I plan to share the code in a future blog post for anyone else who’s interested in calculating MRB or just learning more about Dutch tax systems.