A comprehensive tax calculator supporting multiple countries' tax systems. Built with TypeScript and designed for accuracy and ease of use.
- Support for 20+ countries' tax systems
- Accurate tax bracket calculations
- Social security tax calculations
- Currency formatting by locale
- Standard deduction support
- Comprehensive error handling
npm install universal-tax-calculator
import TaxCalculator from 'universal-tax-calculator';
// Create a calculator instance for a specific country
const calculator = new TaxCalculator('US');
// Calculate taxes for a given income
const result = calculator.calculateTax(100000);
console.log(result);
// Output:
// {
// grossIncome: 100000,
// taxableIncome: 86150,
// totalTax: 15213.50,
// effectiveRate: 0.1766,
// marginalRate: 0.24,
// socialSecurityTax: 6200,
// netIncome: 78586.50,
// breakdown: [...]
// }
// Format currency
const formatted = calculator.formatCurrency(result.netIncome);
console.log(formatted); // "$78,586.50"
- North America: US, Canada, Mexico
- Europe: UK, Germany, France, Italy, Spain
- Asia: Japan, China, India, Singapore
- Oceania: Australia, New Zealand
- South America: Brazil, Argentina
- Africa: South Africa, Nigeria
- Middle East: UAE, Saudi Arabia, Israel
constructor(country: string)
calculateTax(grossIncome: number, options?: {
additionalDeductions?: number;
includeSocialSecurity?: boolean;
}): TaxResult
formatCurrency(amount: number): string
getDeductions(): { [key: string]: number }
getTaxBrackets(): TaxBracket[]
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run build
# Lint
npm run lint
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.