Quarterly taxes due April 15 We'll calculate what you owe and remind you before every deadline.Calculate now →

Skip to main content
Tutorial

Calculate nanny taxes with Python

NannyKeeper Team
March 31, 2026
Updated April 2, 2026
3 min read

If you need to calculate household employer taxes programmatically — for a finance app, a CPA tool, or just automating your own payroll — you can do it in about 10 lines of Python.

How do I calculate nanny taxes in Python?

Get a free API key at nannykeeper.com/developers/keys (30 seconds, email only), then:

import requests

API_KEY = "nk_live_YOUR_KEY"

response = requests.post(
    "https://www.nannykeeper.com/api/v1/calculate",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "state": "CA",
        "annual_wages": 35000,
        "pay_frequency": "biweekly",
    },
)

data = response.json()["data"]

print(f"State: {data['state_name']}")
print(f"Annual wages: ${data['annual_wages']:,.0f}")
print()
print("Employer taxes (annual):")
print(f"  Social Security: ${data['employer_taxes']['social_security']:,.2f}")
print(f"  Medicare:        ${data['employer_taxes']['medicare']:,.2f}")
print(f"  FUTA:            ${data['employer_taxes']['futa']:,.2f}")
print(f"  State unemployment: ${data['employer_taxes']['state_unemployment']:,.2f}")
print(f"  Total:           ${data['employer_taxes']['total']:,.2f}")
print(f"  Effective rate:  {data['employer_taxes']['effective_rate']:.2f}%")
print()
print(f"Per paycheck cost: ${data['per_paycheck']['total_cost']:,.2f}")

Output:

State: California
Annual wages: $35,000

Employer taxes (annual):
  Social Security: $2,170.00
  Medicare:        $507.50
  FUTA:            $42.00
  State unemployment: $238.00
  Total:           $2,957.50
  Effective rate:  8.45%

Per paycheck cost: $1,460.29

How do I check if I even need to pay nanny taxes?

Not everyone who pays a babysitter owes employer taxes. The IRS threshold for 2026 is $3,000 per employee per year. Below that, no federal obligation. Some states trigger earlier though — California at $750/quarter, New York and DC at $500/quarter.

response = requests.get(
    "https://www.nannykeeper.com/api/v1/threshold",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={"state": "CA", "annual_wages": 2500},
)

data = response.json()["data"]

print(f"Federal status: {data['federal']['status']}")
print(f"Explanation: {data['federal']['explanation']}")

if data['state_threshold']:
    print(f"State threshold: ${data['state_threshold']['threshold_quarterly']}/quarter")

How do I compare nanny tax costs across states?

Loop through states. Useful if you're building a tool that shows regional cost differences:

states = ["CA", "NY", "TX", "FL", "WA", "IL", "NJ", "CO"]

print(f"{'State':<6} {'Employer Tax':<14} {'Eff. Rate':<10} {'Per Paycheck'}")
print("-" * 48)

for state in states:
    resp = requests.post(
        "https://www.nannykeeper.com/api/v1/calculate",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"state": state, "annual_wages": 40000, "pay_frequency": "biweekly"},
    )
    d = resp.json()["data"]
    print(
        f"{state:<6} "
        f"${d['employer_taxes']['total']:>10,.2f}   "
        f"{d['employer_taxes']['effective_rate']:>5.2f}%   "
        f"${d['per_paycheck']['total_cost']:>9,.2f}"
    )

The free tier is 50 requests/day. Eight states fits. All 50 in a tight loop eats your daily quota. Paid plans go up to 2,000/day.

What about error handling?

Standard HTTP status codes:

CodeMeaning
200Success
400Bad input — check error.details for which field
401Missing or invalid API key
429Rate limit hit — check Retry-After header

Track your usage with rate limit headers:

remaining = response.headers.get('X-RateLimit-Remaining')
print(f"Remaining today: {remaining}")

Ready to simplify nanny taxes?

NannyKeeper handles the calculations, deadlines, and paperwork so you can focus on your family.

Get started free

FAQ

Is the API free? Yes — 50 requests per day, forever. No credit card. Paid plans ($10-18/month) unlock payroll processing, document generation, and direct deposit.

What Python version do I need? Python 3.7 or later. The requests library is the only dependency (pip install requests).

Can I use this in production? Yes. The API is the same engine that runs NannyKeeper's payroll product. For production apps, consider a paid plan for higher rate limits (500-2,000/day).

Related posts

Disclaimer: This article is for informational purposes only and does not constitute legal or tax advice. Tax laws vary by jurisdiction and change frequently. Consult a qualified tax professional for advice specific to your situation.

Ready to simplify nanny payroll?

Start tracking payments for free. Upgrade when you need full tax filing.

Get Started Free