{
  "id": "pizza",
  "version": "350211afe17f",
  "status": "published",
  "name": "Pizza Calculator",
  "question": "How many pizzas do I need?",
  "summary": "Works out how many pizzas to order for a group from the people, the slices each person eats and the slices per pizza, with the cost, the price per square inch and which of two sizes is the better deal.",
  "category": "food",
  "subcategory": "cooking",
  "url": "https://www.acalculator.org/food/pizza-calculator",
  "markdown": "https://www.acalculator.org/food/pizza-calculator.md",
  "kind": "function",
  "method": "pizzas = ⌈people × slices per person ÷ slices per pizza⌉; area = π × (d ÷ 2)²; price per in² = price ÷ area.",
  "assumptions": [
    "Pizzas are round and every slice is eaten by someone; there is no extra pizza for big eaters.",
    "Prices are what you type; the page fetches no menus or prices.",
    "Sizes from 1 to 100 in (2.54 to 254 cm) across."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "people": {
        "title": "People",
        "description": "How many people will eat.",
        "type": "integer",
        "minimum": 1,
        "maximum": 100000
      },
      "each": {
        "title": "Slices per person",
        "description": "How many slices each person eats, on average. 2 to 3 is common for adults.",
        "type": "number",
        "minimum": 0.5,
        "maximum": 50
      },
      "slices": {
        "title": "Slices per pizza",
        "description": "How many slices each pizza is cut into.",
        "type": "integer",
        "minimum": 1,
        "maximum": 64
      },
      "d": {
        "title": "Pizza size",
        "description": "The width of the pizza across the middle, from crust to crust.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.0254,
        "maximum": 2.54
      },
      "price": {
        "title": "Price per pizza",
        "description": "What one pizza costs. Leave empty to skip the cost.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 10000
      },
      "d2": {
        "title": "Other size",
        "description": "The width of another pizza to compare, across the middle.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.0254,
        "maximum": 2.54
      },
      "price2": {
        "title": "Price of the other size",
        "description": "What one pizza of the other size costs.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 10000
      }
    }
  },
  "outputs": {
    "pizzas": {
      "label": "Pizzas to order",
      "description": "People × slices per person ÷ slices per pizza, rounded up to a whole pizza.",
      "format": "integer"
    },
    "needed": {
      "label": "Slices needed",
      "description": "People × slices per person.",
      "format": "number"
    },
    "spare": {
      "label": "Slices left over",
      "description": "The slices in the pizzas ordered minus the slices needed.",
      "format": "number"
    },
    "area": {
      "label": "Area of one pizza",
      "description": "π × (diameter ÷ 2)², in square inches.",
      "format": "number"
    },
    "areaCm": {
      "label": "Area of one pizza (cm²)",
      "description": "The same area in square centimetres (1 in² = 6.4516 cm²).",
      "format": "number"
    },
    "perPerson": {
      "label": "Pizza per person",
      "description": "The area of the pizzas ordered divided by the people, in square inches.",
      "format": "number"
    },
    "cost": {
      "label": "Total cost",
      "description": "Pizzas × price per pizza.",
      "format": "money"
    },
    "costEach": {
      "label": "Cost per person",
      "description": "The total cost divided by the people.",
      "format": "money"
    },
    "perSqIn": {
      "label": "Price per square inch",
      "description": "The price of one pizza divided by its area.",
      "format": "money"
    },
    "perSqIn2": {
      "label": "Other size: price per square inch",
      "description": "The other pizza’s price divided by its area.",
      "format": "money"
    },
    "ratio": {
      "label": "Size ratio",
      "description": "How many of the other size make one pizza: (diameter ÷ other diameter)².",
      "format": "number"
    },
    "deal": {
      "label": "Better deal",
      "description": "The size with the lower price per square inch.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "people": 10,
      "each": 3,
      "slices": 8,
      "d": "14in",
      "price": 15,
      "d2": "10in"
    },
    "outputs": {
      "pizzas": 4,
      "needed": 30,
      "spare": 2,
      "area": 153.93804002589985,
      "areaCm": 993.1466590310955,
      "perPerson": 61.57521601035994,
      "cost": 60,
      "costEach": 6,
      "perSqIn": 0.09744180189299716,
      "ratio": 1.96
    },
    "text": "For 10 people eating 3 slices each, order 4 pizzas."
  },
  "examples": [
    {
      "given": {
        "people": 10,
        "each": 3,
        "slices": 8,
        "d": 0.35559999999999997,
        "price": 15
      },
      "expect": {
        "pizzas": 4,
        "needed": 30,
        "spare": 2,
        "area": 153.93804002589985,
        "cost": 60,
        "costEach": 6,
        "perSqIn": 0.09744180189299716
      },
      "source": "hand calculation in content.mdx: ⌈10 × 3 ÷ 8⌉ = ⌈3.75⌉ = 4; π × 7² = 153.94 in²; OpenStax, Prealgebra 2e, §9.5 Solve Geometry Applications: Circles and Irregular Figures, area of a circle A = πr² (https://openstax.org/books/prealgebra-2e/pages/9-5-solve-geometry-applications-circles-and-irregular-figures, retrieved 2026-10-02)"
    },
    {
      "given": {
        "people": 6,
        "each": 2.5,
        "slices": 6,
        "d": 0.3,
        "price": 12,
        "d2": 0.4,
        "price2": 20
      },
      "expect": {
        "pizzas": 3,
        "spare": 3,
        "ratio": 0.5625,
        "deal": "The other size costs less per square inch"
      },
      "source": "hand calculation in content.mdx: 12 × 40² = 19,200 > 20 × 30² = 18,000; OpenStax, Prealgebra 2e, §9.5 Solve Geometry Applications: Circles and Irregular Figures, area of a circle A = πr² (https://openstax.org/books/prealgebra-2e/pages/9-5-solve-geometry-applications-circles-and-irregular-figures, retrieved 2026-10-02); NIST SP 811 Appendix B: 1 in = 2.54 cm exactly (https://www.nist.gov/pml/special-publication-811, retrieved 2026-10-02)"
    },
    {
      "given": {
        "people": 4,
        "each": 2,
        "slices": 8,
        "d": 0.4064,
        "price": 18,
        "d2": 0.2032,
        "price2": 4.5
      },
      "expect": {
        "pizzas": 1,
        "spare": 0,
        "ratio": 4,
        "deal": "Both sizes cost the same per square inch"
      },
      "source": "hand calculation in content.mdx: (16 ÷ 8)² = 4; 18 × 8² = 4.5 × 16² = 1,152; OpenStax, Prealgebra 2e, §9.5 Solve Geometry Applications: Circles and Irregular Figures, area of a circle A = πr² (https://openstax.org/books/prealgebra-2e/pages/9-5-solve-geometry-applications-circles-and-irregular-figures, retrieved 2026-10-02)"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, §9.5 Solve Geometry Applications: Circles and Irregular Figures (area of a circle A = πr²; a pizza example), CC BY 4.0, retrieved 2026-10-02. https://openstax.org/books/prealgebra-2e/pages/9-5-solve-geometry-applications-circles-and-irregular-figures",
    "USDA FoodData Central, FDC 170317, Pizza, cheese topping, regular crust, frozen, cooked (SR Legacy): energy 268 kcal per 100 g, retrieved 2026-10-02. https://fdc.nal.usda.gov/food-details/170317/nutrients",
    "NIST Special Publication 811, Guide for the Use of the International System of Units, Appendix B (1 in = 2.54 cm exactly), retrieved 2026-10-02. https://www.nist.gov/pml/special-publication-811"
  ],
  "related": [
    "recipe-calorie",
    "food-calorie",
    "area-of-a-circle",
    "discount"
  ],
  "changelog": []
}
