Skip to main content

🇨🇦 Canatax – Canadian Tax Calculator

PyPI - Version PyPI - Downloads Python Version License

Canatax is a dependency-free Python package for estimating Canadian income and sales taxes. Built for developers who need quick tax calculations for applications, prototyping, or general estimation purposes.

⚠️ Important Disclaimer

This software provides tax estimates only and is not professional accounting software. I am not a licensed accountant or tax professional. While the calculations are based on current CRA guidelines and provincial tax rates, this tool should not be used as your sole source for tax planning, filing, or financial decisions.

For official tax advice, consult a qualified accountant or use CRA-approved software.

Features

Income Tax Estimation:

  • Federal and provincial/territorial income tax
  • CPP/QPP contributions (province-specific)
  • Employment Insurance (EI) premiums
  • Quebec Parental Insurance Plan (QPIP) for Quebec residents
  • Basic Personal Amount (BPA) calculations with high-income phase-outs
  • Uses 2025 tax rates and brackets

Sales Tax Calculation:

  • GST, PST, HST, and QST calculations
  • Automatic tax selection based on province/territory
  • Structured breakdown of all applicable taxes

Zero Dependencies: Pure Python with no external requirements.

Installation

pip install canatax

Quick Start

Income Tax Estimation

from canatax import IncomeTaxCalculator

# Calculate tax estimate for $80,000 income in British Columbia
estimate = IncomeTaxCalculator.calculate(income=80000, province="BC")

print(f"Province: {estimate.province}")
print(f"Federal Tax: ${estimate.federal_tax:,.2f}")
print(f"Provincial Tax: ${estimate.provincial_tax:,.2f}")
print(f"CPP: ${estimate.cpp:,.2f}")
print(f"EI: ${estimate.ei:,.2f}")
print(f"Total Tax: ${estimate.total_tax:,.2f}")
print(f"Net Income: ${estimate.net_income:,.2f}")

Sales Tax Calculation

from canatax import SalesTaxCalculator

# Calculate sales tax for $100 purchase in Quebec
estimate = SalesTaxCalculator.calculate(amount=100.00, province="QC")

print(f"Province: {estimate.province}")
print(f"GST: ${estimate.gst:,.2f}")
print(f"QST: ${estimate.qst:,.2f}")
print(f"Total Tax: ${estimate.tax_total:,.2f}")
print(f"After Tax: ${estimate.after_tax:,.2f}")

API Reference

IncomeTaxCalculator

IncomeTaxCalculator.calculate(income: float, province: str) -> IncomeTaxEstimate

Calculates income tax estimate for the given income and province.

Parameters:

  • income: Annual gross income (float)
  • province: Two-letter province code (e.g., "ON", "BC", "QC")

Returns: IncomeTaxEstimate object with calculated taxes and deductions.

SalesTaxCalculator

SalesTaxCalculator.calculate(amount: float, province: str) -> SalesTaxEstimate

Calculates applicable sales taxes for a purchase amount.

Parameters:

  • amount: Purchase amount before tax (float)
  • province: Two-letter province code

Returns: SalesTaxEstimate object with tax breakdown.

Supported Provinces and Territories

All Canadian provinces and territories are supported:

  • AB, BC, MB, NB, NL, NT, NS, NU, ON, PE, QC, SK, YT

Use Cases

  • E-commerce applications: Calculate tax estimates for shopping carts
  • Payroll prototyping: Rough estimation of payroll deductions
  • Financial planning tools: Provide ballpark tax calculations
  • Educational purposes: Demonstrate Canadian tax system mechanics
  • Budget calculators: Help users estimate take-home pay

Accuracy Notes

Tax calculations are based on:

  • Current CRA federal tax brackets and rates
  • Provincial/territorial tax rates and basic personal amounts (BPAs)
  • 2025 CPP, EI, and other contribution limits
  • Published GST/PST/HST rates by province

Limitations:

  • Does not account for tax credits beyond basic personal amounts
  • Does not include deductions for RRSP, childcare, etc.
  • Simplified calculation model suitable for estimation purposes
  • May not reflect mid-year rate changes or special circumstances

Contributing

Bug reports, feature requests, and contributions are welcome! This project helps developers build better financial tools for Canadians.

License

MIT License – Free for personal and commercial use.

Support

If this tool has been helpful for your projects, consider buying me a coffee. No promises that I'll spend the money responsibly.

Metadata

Release files for canatax 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for canatax 2.0.1
File Size Uploaded Provenance Actions
canatax-2.0.1.tar.gz 17.2 kB Without provenance Details for canatax-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for canatax 2.0.1
File Interpreter ABI Platform Actions
canatax-2.0.1-py3-none-any.whl Python 3 none any Details for canatax-2.0.1-py3-none-any.whl

Total release size: 37.1 kB

Release files / canatax-2.0.1.tar.gz

Download URL canatax-2.0.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e350541b963030247ccbe879454446d0fe63a2a0bc7308ae1860ef0902c085bc
BLAKE2b-256 checksum
How to use checksums
393a2eac47a5976f81946feac9f15ca43110f9bc24b7013a2e063ac28dfacfe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / canatax-2.0.1-py3-none-any.whl

Download URL canatax-2.0.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27ffd706cb47fd5b8950864cb77dc204d74e21edb861413b12bcc59ed33e9ba9
BLAKE2b-256 checksum
How to use checksums
4b37b7da9faaad9f611f8e39f5392c58fde2fec7e768d76229b06ec5b55242d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for canatax 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page