Tip Calculator Formula

Understand the math behind the tip calculator. Each variable explained with a worked example.

Formulas Used

Tip Amount

tip_amount = bill_amount * tip_pct / 100

Total (Bill + Tip)

total = bill_amount + bill_amount * tip_pct / 100

Per Person

per_person = split > 0 ? (bill_amount + bill_amount * tip_pct / 100) / split : 0

Tip Per Person

tip_per_person = split > 0 ? (bill_amount * tip_pct / 100) / split : 0

Variables

VariableDescriptionDefault
bill_amountBill Amount(USD)85
tip_pctTip Percentage(%)18
splitSplit Between(people)2

How It Works

How to Calculate a Tip

Formula

Tip = Bill x (Tip% / 100) Total = Bill + Tip Per Person = Total / Number of People

Quick mental math: for 20%, move the decimal one place left and double it. For 15%, find 10% and add half again.

Worked Example

An $85 bill with 18% tip split between 2 people.

bill_amount = 85tip_pct = 18split = 2
  1. 01Tip = $85 x 0.18 = $15.30
  2. 02Total = $85 + $15.30 = $100.30
  3. 03Per person = $100.30 / 2 = $50.15
  4. 04Tip per person = $15.30 / 2 = $7.65

Ready to run the numbers?

Open Tip Calculator