Skip to main content

An implementation of UK income tax Pay-As-You-Earn calculations

Project description

PAYE

Implementation of UK Income Tax Pay-As-You-Earn algorithms

In the UK, many employees and pensioners pay income tax in weekly or monthly installments as a deduction on their payslip under a system known as Pay-As-You-Earn or PAYE.

In this system, His/Her Majesty's Revenue and Customs (HMRC) gives the employer/pension provider a "Tax Code" which they use to calculate how much income tax to deduct.

This package implements the algorithms for calculating the income tax due as defined by HMRC in their "SPECIFICATION FOR PAYE TAX TABLE ROUTINES" Version 24, dated January 2026

HMRC Constants

The algorithms use a set of constants that are dependent on tax year and defined in the Specification.

This package reads the constants from a TOML file 'hmrc.toml' which needs to be updated for each new tax year.

Exported Objects

  1. the TaxCode class
  2. the Payslip class
  3. the tax_due function
  4. utility functions str_to_decimal and uk_tax_period_start_date

Usage

Weekly vs Monthly pay is selected by the environment variable PAYE_PERIOD: PAYE_PERIOD=weekly or PAYE_PERIOD=monthly

if unset, monthly is assumed

The inputs are:

  1. Your gross pay for the week / month
  2. Your total gross pay for the tax year including this week / month
  3. Your tax code for the week / month (as given by HMRC via a letter or your Personal Tax Account on gov.uk)
  4. The income tax you've paid so far this tax year, NOT including this week/month

Use these to create an instance of the Payslip class Pass this payslip, and the tax_to_date to the tax_due function

Output:

The income tax payable this week / month

Testing

This module is validated against the test cases provided by HMRC

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paye-0.4.2.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paye-0.4.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file paye-0.4.2.tar.gz.

File metadata

  • Download URL: paye-0.4.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

File hashes

Hashes for paye-0.4.2.tar.gz
Algorithm Hash digest
SHA256 2fa6c515c4f0a6594dd66b610118c3ddfa0da7fd396b3a21ca08ec0fac50b531
MD5 433e482660794754ff6d03074ab02bee
BLAKE2b-256 99a35e58e26201aa90bd743132f3462c35ba717c1cc80cbe9dd4e486e517d87e

See more details on using hashes here.

File details

Details for the file paye-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: paye-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.14.3 HTTPX/0.28.1

File hashes

Hashes for paye-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 568d147cdea923c2573175b61c7f5f8910bc94d24643c1179d6af932a19bea98
MD5 5c89dbe19fedccf2e545a1775f25ef46
BLAKE2b-256 eb76ed6d6ce1db5c82406000d2e77fff21da4c50bed8904a9ef6c4762ffad50f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page