{
  "id": "tip",
  "version": "e215a17b1049",
  "status": "published",
  "name": "Tip Calculator",
  "question": "How much should I tip?",
  "summary": "Computes the tip and the total for a bill at a tip percent, and splits it between people, with an option to round each share up to a whole dollar.",
  "category": "everyday-life",
  "url": "https://www.acalculator.org/everyday-life/tip-calculator",
  "markdown": "https://www.acalculator.org/everyday-life/tip-calculator.md",
  "kind": "function",
  "method": "tip = bill × tip % ÷ 100; total = bill + tip; share = total ÷ people",
  "assumptions": [
    "The tip is on the amount you enter. To tip on the amount before tax, enter the bill before tax.",
    "Rounding up: each exact share rounds up to the next whole dollar, so it is never less than the exact share; a share within 0.000000001 of a whole dollar counts as that dollar. The tip then becomes the rounded total minus the bill.",
    "Everyone pays an equal share."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "bill": {
        "title": "Bill amount",
        "description": "The amount of the bill that you tip on.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 10000000
      },
      "tip": {
        "title": "Tip",
        "description": "The tip as a percent of the bill.",
        "type": "number",
        "x-unit": "percent",
        "minimum": 0,
        "maximum": 100
      },
      "people": {
        "title": "Split between",
        "description": "How many people share the bill.",
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "round": {
        "title": "Round each share",
        "description": "Leave each share exact, or round it up to the next whole dollar.",
        "type": "string",
        "enum": [
          "no",
          "up"
        ]
      }
    }
  },
  "outputs": {
    "share": {
      "label": "Each person pays",
      "description": "The total divided by the number of people, rounded up to a whole dollar if asked.",
      "format": "money"
    },
    "tip": {
      "label": "Tip",
      "description": "The total tip on the bill.",
      "format": "money"
    },
    "total": {
      "label": "Total with tip",
      "description": "The bill plus the tip.",
      "format": "money"
    },
    "tipShare": {
      "label": "Tip per person",
      "description": "Each person’s part of the tip.",
      "format": "money"
    },
    "effective": {
      "label": "Tip as a percent of the bill",
      "description": "The tip actually paid, as a percent of the bill. Rounding up can raise it.",
      "format": "percent"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "bill": 60,
      "tip": 18,
      "people": 1,
      "round": "no"
    },
    "outputs": {
      "share": 70.8,
      "tip": 10.799999999999997,
      "total": 70.8,
      "tipShare": 10.799999999999997,
      "effective": 17.999999999999996
    },
    "text": "With a 18% tip on $60.00, the tip is $10.80 and each person pays $70.80."
  },
  "examples": [
    {
      "given": {
        "bill": 60,
        "tip": 18,
        "people": 1,
        "round": "no"
      },
      "expect": {
        "tip": 10.8,
        "total": 70.8,
        "share": 70.8,
        "effective": 18
      },
      "source": "hand calculation in content.mdx: 60 × 0.18 = 10.80; 60 + 10.80 = 70.80",
      "tolerance": 1e-12
    },
    {
      "given": {
        "bill": 85.4,
        "tip": 20,
        "people": 3,
        "round": "no"
      },
      "expect": {
        "tip": 17.08,
        "total": 102.48,
        "share": 34.16,
        "tipShare": 5.6933333333333325
      },
      "source": "hand calculation in content.mdx: 85.40 × 0.20 = 17.08; 102.48 ÷ 3 = 34.16",
      "tolerance": 1e-12
    },
    {
      "given": {
        "bill": 85.4,
        "tip": 20,
        "people": 3,
        "round": "up"
      },
      "expect": {
        "share": 35,
        "total": 105,
        "tip": 19.6,
        "effective": 22.950819672131146
      },
      "source": "hand calculation in content.mdx: 34.16 rounds up to 35; 35 × 3 = 105; 105 − 85.40 = 19.60 (22.95%)",
      "tolerance": 1e-12
    }
  ],
  "sources": [],
  "related": [
    "discount",
    "percentage"
  ],
  "changelog": []
}
