Skip to main content

An easy-to-use, dependency-free Canadian sales and income tax calculator.

Project description

🇨🇦 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.

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

canatax-2.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

canatax-2.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file canatax-2.0.1.tar.gz.

File metadata

  • Download URL: canatax-2.0.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for canatax-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e350541b963030247ccbe879454446d0fe63a2a0bc7308ae1860ef0902c085bc
MD5 9cfe740698a4b9d76baa6053de4fcbc7
BLAKE2b-256 393a2eac47a5976f81946feac9f15ca43110f9bc24b7013a2e063ac28dfacfe3

See more details on using hashes here.

File details

Details for the file canatax-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: canatax-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for canatax-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27ffd706cb47fd5b8950864cb77dc204d74e21edb861413b12bcc59ed33e9ba9
MD5 0b64a1f87c260b82cccf3cd055b58b68
BLAKE2b-256 4b37b7da9faaad9f611f8e39f5392c58fde2fec7e768d76229b06ec5b55242d2

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