Enrolling in a Dependent Care FSA?How to claim up to $7,500
Skip to main content
Tutorial

Calculate nanny taxes with Python

NannyKeeper Team
March 31, 2026
Updated November 3, 2026
4 min read
Share this:

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}")
for part in data["employer_taxes"]["state_unemployment_components"]:
    print(f"    {part['name']}: ${part['amount']:,.2f} ({part['rate'] * 100:.1f}%)")
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: $245.00
    Unemployment Insurance: $238.00 (3.4%)
    Employment Training Tax: $7.00 (0.1%)
  Total:           $2,964.50
  Effective rate:  8.47%

Per paycheck cost: $1,460.17

That extra loop matters in California. The EDD assigns one rate covering two taxes, so state_unemployment there is Unemployment Insurance plus the Employment Training Tax, and a family reading only the total will go looking for an ETT line they never find. state_unemployment_components breaks it out for every state; the amounts always add up to state_unemployment, and in states that charge one tax you get a single entry.

Four states bundle differently, and it is worth knowing which. Washington, Colorado, Arkansas and Wisconsin publish a single rate that is already more than one tax, so there is no split for us to report. Our Washington default, 1.28% (what ESD has billed the new households we see), is 1.26% unemployment insurance plus a 0.02% Employment Administration Fund charge on the same ESD invoice. Those come back as one component with an includes array naming the parts and no separate amounts, because the split lives on your rate notice rather than in our data.

Track your nanny's pay free

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

Not everyone who pays a babysitter owes FICA. The 2026 Social Security and Medicare threshold is $3,000 per nonexempt employee per year. Below that, FICA generally does not apply to that worker, but the separate household-wide $1,000-in-a-quarter FUTA test and state rules can still apply.

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}")

Free to start

Track what you pay your nanny, free.

NannyKeeper shows you when you cross the $3,000 threshold, then prepares your W-2 and Schedule H from $10 a month.

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).

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.

Found this helpful? Share it:

Free to start

Start by tracking what you pay your nanny, free.

When you're ready to run payroll, we prepare your W-2 and Schedule H and give you the figures for every quarterly payment, from $10 a month.