Did you know ... Search Documentation:
Pack fr_bareme_km -- README.md

fr_bareme_km

SWI-Prolog facts and calculator for the French tax mileage allowance scale ("bareme kilometrique"), used to deduct professional travel costs ("frais reels") from French income tax.

Installation

?- pack_install(fr_bareme_km).

Usage

?- use_module(library(fr_bareme_km)).

% 2026 scale (2025 kilometres), 5 CV car, 4 000 km
?- frais_km(2026, automobile, 5, 4000, M).
M = 2544.

% Same car, 100 % electric (+20 %)
?- frais_km(2026, automobile, 5, 4000, [electrique(true)], M).
M = 3052.8.

% Raw facts
?- bareme_km(2026, motocyclette, cv_plus_de_5, T, F).
T = tranche(0, 3000),     F = formule(0.606, 0) ;
T = tranche(3000, 6000),  F = formule(0.079, 1583) ;
T = tranche(6000, inf),   F = formule(0.343, 0).

Schema

bareme_km(Annee, Vehicule, Classe, tranche(Min, Max), formule(Coef, Constante))
ArgumentMeaning
AnneeYear of the tax return (2022..2026). Kilometres are those of the previous year, see annee_revenus/2.
Vehiculeautomobile, motocyclette, cyclomoteur
Classeautomobile: cv3_et_moins, cv4, cv5, cv6, cv7_et_plus; motocyclette: cv1_2, cv3_4_5, cv_plus_de_5; cyclomoteur: toutes
trancheBand applies when Min < Km =< Max (first band 0 =< Km =< Max), inf for the last band
formuleAmount in euros = Km * Coef + Constante

Predicates:

  • frais_km(+Annee, +Vehicule, +CV, +Km, -Montant): amount in euros, rounded to the cent.
  • frais_km(+Annee, +Vehicule, +CV, +Km, +Options, -Montant): option electrique(true).
  • classe_puissance(+Vehicule, +CV, -Classe): maps an integer horsepower to its class.
  • `annee_revenus(?AnneeDeclaration, ?AnneeRevenus)`.
  • `source_bareme(?AnneeDeclaration, ?Source)`: official text used for each year.

Electric vehicles

The code applies the 20 % increase to the computed amount, as written in the tax code (CGI, annexe IV, art. 6 B, II). The DGFiP brochure also prints separate electric tables whose coefficients are rounded to three decimals; results can differ from those tables by less than one euro.

Sources and verification

Every value was checked against the official text for its year:

Declaration yearIncome yearOfficial source
20222021BOFIP BOI-BAREME-000001-20230720
20232022BOFIP BOI-BAREME-000001-20230720
20242023DGFiP brochure pratique IR 2024
20252024DGFiP brochure pratique IR 2025
20262025service-public.gouv.fr A14686 and DGFiP brochure pratique IR 2026

The scale was raised by 10 % in 2022 and by 5.4 % in 2023, then kept unchanged for the 2024, 2025 and 2026 tax returns.

Dataset: MaCalculatriceEnLigne, "Bareme kilometrique fiscal France 2022-2026", Mendeley Data, V1, doi:10.17632/5s59m9wycw.1 (CC BY 4.0).

This package is an aid to calculation, not tax advice. The official texts prevail.

Tests

cd test
swipl -g run_tests -t halt test_fr_bareme_km.pl

Licence

Code: MIT (see LICENSE). Data: official French tax data under the Licence Ouverte / Open Licence (Etalab), see LICENSE for attribution.