Untitled

 avatar
unknown
plain_text
2 months ago
2.5 kB
4
Indexable
import streamlit as st

def salary_vs_dividends_calculator(salary, dividend):
    personal_allowance = 12570  # Tax-free allowance
    dividend_allowance = 1000  # Tax-free dividend allowance
    corp_tax_rate = 0.19  # Corporation tax rate

    # UK income tax bands (2024/25)
    income_tax_bands = [(50270, 0.20), (125140, 0.40), (float('inf'), 0.45)]
    dividend_tax_bands = [(50270, 0.0875), (125140, 0.325), (float('inf'), 0.3975)]

    # PAYE tax calculations
    taxable_salary = max(0, salary - personal_allowance)
    salary_tax = sum(min(taxable_salary, band) * rate for band, rate in income_tax_bands if taxable_salary > 0)
    ni_contributions = max(0, (salary - 12570) * 0.12)  # Class 1 NI estimate
    net_salary = salary - salary_tax - ni_contributions

    # Dividends tax calculations
    company_profit = salary + dividend
    post_corp_profit = company_profit * (1 - corp_tax_rate)
    taxable_dividend = max(0, post_corp_profit - dividend_allowance)
    dividend_tax = sum(min(taxable_dividend, band) * rate for band, rate in dividend_tax_bands if taxable_dividend > 0)
    net_dividend = post_corp_profit - dividend_tax

    return net_salary, net_dividend, salary_tax + ni_contributions, dividend_tax

# Streamlit Web App
st.title("Salary vs Dividends Tax Calculator")
st.markdown("Calculate tax-efficient income for business owners.")

# User Input
salary = st.number_input("Enter your salary (£):", min_value=0, value=30000, step=1000)
dividend = st.number_input("Enter your dividend (£):", min_value=0, value=20000, step=1000)

# Calculate and Display Results
net_salary, net_dividend, salary_tax, dividend_tax = salary_vs_dividends_calculator(salary, dividend)
st.markdown(f"### Net Income Breakdown:")
st.markdown(f"- **Net Salary (After Tax & NI):** £{net_salary:,.2f}")
st.markdown(f"- **Net Dividend (Post-Corporation Tax):** £{net_dividend:,.2f}")
st.markdown(f"- **Total Tax & NI on Salary:** £{salary_tax:,.2f}")
st.markdown(f"- **Total Dividend Tax:** £{dividend_tax:,.2f}")

# Disclaimers & Additional Considerations
st.markdown("---")
st.markdown("### Important Considerations & Disclaimers")
st.markdown("""
- **This calculator provides an estimate** and does not account for personal allowances, reliefs, or additional tax considerations.
- **Corporation tax rates** may vary based on company profits.
- **Dividends over £1,000 are taxable**, and tax rates vary based on total income.
- **Consult a tax professional** for personalized financial planning.
""")
Editor is loading...
Leave a Comment