Income Tax Calculator Using Python

Introduction

The Income Tax Calculator is designed to help taxpayers easily compute their income tax liabilities for FY 2024-25. It supports both the Old and New Tax Regimes, allowing users to select their preferred regime and see a detailed breakdown of their tax calculations. This tool simplifies the process of understanding tax implications and helps make informed financial decisions.


Why Build an Income Tax Calculator?

  • Ease of Calculation: Tax slabs can be complex, and this tool simplifies the process.
  • Comparison: Helps users compare the old and new tax regimes easily.
  • Practical Application: Great for taxpayers, accountants, and learners looking to apply Python to real-world scenarios.

Prerequisites

Before running the program, ensure:

  • Python 3.x is installed on your system.
  • Basic understanding of Python functions and conditional logic.

Code Snippet

def calculate_tax_old_regime(income):
    """
    Calculate income tax as per the old tax regime slabs for FY 2024-25.
    """
    tax = 0
    if income <= 250000:  # No tax for income up to ₹2,50,000
        tax = 0
    elif income <= 500000:  # 5% tax on income above ₹2,50,000
        tax = 0.05 * (income - 250000)
    elif income <= 1000000:  # 20% tax on income above ₹5,00,000
        tax = 0.05 * 250000 + 0.2 * (income - 500000)
    else:  # 30% tax on income above ₹10,00,000
        tax = 0.05 * 250000 + 0.2 * 500000 + 0.3 * (income - 1000000)
    return tax


def calculate_tax_new_regime(income):
    """
    Calculate income tax as per the new tax regime slabs for FY 2024-25.
    """
    tax = 0
    if income <= 300000:  # No tax for income up to ₹3,00,000
        tax = 0
    elif income <= 600000:  # 5% tax on income above ₹3,00,000
        tax = 0.05 * (income - 300000)
    elif income <= 900000:  # 10% tax on income above ₹6,00,000
        tax = 0.05 * 300000 + 0.1 * (income - 600000)
    elif income <= 1200000:  # 15% tax on income above ₹9,00,000
        tax = 0.05 * 300000 + 0.1 * 300000 + 0.15 * (income - 900000)
    elif income <= 1500000:  # 20% tax on income above ₹12,00,000
        tax = 0.05 * 300000 + 0.1 * 300000 + 0.15 * 300000 + 0.2 * (income - 1200000)
    else:  # 30% tax on income above ₹15,00,000
        tax = (
            0.05 * 300000
            + 0.1 * 300000
            + 0.15 * 300000
            + 0.2 * 300000
            + 0.3 * (income - 1500000)
        )
    return tax


def main():
    print("Income Tax Calculator (India) FY 2024-25")
    try:
        income = float(input("Enter your annual taxable income (₹): "))
        if income <= 0:
            print("Income must be a positive number.")
            return

        print("\nChoose Tax Regime:")
        print("1. Old Regime")
        print("2. New Regime")
        choice = input("Enter your choice (1 or 2): ")

        if choice == "1":
            tax = calculate_tax_old_regime(income)
            print(f"Income Tax under Old Regime: ₹{tax:,.2f}")
        elif choice == "2":
            tax = calculate_tax_new_regime(income)
            print(f"Income Tax under New Regime: ₹{tax:,.2f}")
        else:
            print("Invalid choice. Please enter 1 or 2.")
    except ValueError:
        print("Invalid input. Please enter a numeric value for income.")


if __name__ == "__main__":
    main()

How the Code Works

1. Old Tax Regime

  • No tax for income up to ₹2,50,000.
  • 5% tax for the next ₹2,50,000.
  • 20% tax for income between ₹5,00,000 and ₹10,00,000.
  • 30% tax for income above ₹10,00,000.

2. New Tax Regime

  • No tax for income up to ₹3,00,000.
  • 5% tax for the next ₹3,00,000.
  • 10% tax for income between ₹6,00,000 and ₹9,00,000.
  • 15% tax for income between ₹9,00,000 and ₹12,00,000.
  • 20% tax for income between ₹12,00,000 and ₹15,00,000.
  • 30% tax for income above ₹15,00,000.

3. Main Function

  • Accepts user input for taxable income.
  • Provides an option to choose between the old or new tax regime.
  • Calls the appropriate function to compute and display the tax amount.

Output

Example 1: Old Regime
Input: ₹7,50,000
Output:

Income Tax under Old Regime: ₹65,000.00  

Example 2: New Regime
Input: ₹7,50,000
Output:

Income Tax under New Regime: ₹25,000.00  

Improvements and Suggestions

  • Error Handling: Includes error messages for invalid inputs and non-numeric values.
  • Customizations: Easily adaptable to future tax slab changes.
  • UI Integration: Consider integrating the code into a GUI for user-friendliness.

Links

Income Tax Calculator using Python

How to create Graphical User Interface in Python ?

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top