{
  "id": "lego-price-per-piece",
  "version": "f3e75e9b6136",
  "status": "published",
  "name": "LEGO Price Per Piece Calculator",
  "question": "What does each brick cost?",
  "summary": "Works out the price per piece of a building-brick set from its price and piece count, after an optional discount, with pieces per dollar, and compares two sets to show the better value per piece.",
  "category": "everyday-life",
  "subcategory": "money-and-shopping",
  "url": "https://www.acalculator.org/everyday-life/lego-price-per-piece-calculator",
  "markdown": "https://www.acalculator.org/everyday-life/lego-price-per-piece-calculator.md",
  "kind": "function",
  "method": "price you pay = price × (1 − discount ÷ 100); price per piece = price you pay ÷ pieces; pieces per dollar = pieces ÷ price you pay. Compare: the set with the lower price per piece is the better value.",
  "assumptions": [
    "The piece count is the number printed on the box; minifigures and spare pieces count as pieces if the box counts them.",
    "Prices are what you type; there is no store data. Sales tax is not included.",
    "Arithmetic is exact on the typed decimals; money shows to a tenth of a cent, rounded half up.",
    "Price per piece says nothing about the size or rarity of the pieces."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "price": {
        "title": "Set price",
        "description": "The price of the set, before any discount.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0.01,
        "maximum": 1000000
      },
      "pcs": {
        "title": "Pieces",
        "description": "The number of pieces in the set, from the box.",
        "type": "integer",
        "minimum": 1,
        "maximum": 10000000
      },
      "off": {
        "title": "Discount",
        "description": "A sale or coupon discount off the set price, in percent. Leave empty for none.",
        "type": "number",
        "x-unit": "percent",
        "minimum": 0,
        "exclusiveMaximum": 100
      },
      "price2": {
        "title": "Second set price",
        "description": "Optional: the price of a second set to compare, after any discount.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0.01,
        "maximum": 1000000
      },
      "pcs2": {
        "title": "Second set pieces",
        "description": "Optional: the number of pieces in the second set.",
        "type": "integer",
        "minimum": 1,
        "maximum": 10000000
      }
    }
  },
  "outputs": {
    "ppp": {
      "label": "Price per piece",
      "description": "The price you pay (after the discount) divided by the number of pieces.",
      "format": "money"
    },
    "cents": {
      "label": "Cents per piece",
      "description": "The price per piece in cents.",
      "format": "number"
    },
    "perDollar": {
      "label": "Pieces per dollar",
      "description": "How many pieces each dollar buys: pieces divided by the price you pay.",
      "format": "number"
    },
    "paid": {
      "label": "Price you pay",
      "description": "The set price after the discount.",
      "format": "money"
    },
    "ppp2": {
      "label": "Second set: price per piece",
      "description": "The second set’s price divided by its pieces.",
      "format": "money"
    },
    "better": {
      "label": "Better value per piece",
      "description": "Which set costs less per piece, and by how much in percent.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "price": 79.99,
      "pcs": 800
    },
    "outputs": {
      "ppp": 0.0999875,
      "cents": 9.99875,
      "perDollar": 10.001250156269533,
      "paid": 79.99
    },
    "text": "At $79.99 for 800 pieces, each piece costs $0.100 (10 pieces per dollar)."
  },
  "examples": [
    {
      "given": {
        "price": 79.99,
        "pcs": 800
      },
      "expect": {
        "ppp": 0.0999875,
        "cents": 9.99875,
        "perDollar": 10.001250156269533,
        "paid": 79.99
      },
      "source": "hand calculation in content.mdx: 79.99 ÷ 800 = $0.0999875 (10.0¢); 800 ÷ 79.99 = 10.0 pieces per dollar; NIST SP 1181, Unit Pricing Guide: A Best Practice Approach to Unit Pricing (2025 edition) (best practice for unit pricing: the price per unit of measure, here per piece). https://www.nist.gov/publications/nist-sp-1181-unit-pricing-guide-best-practice-approach-unit-pricing-2025-ed, retrieved 2026-10-02"
    },
    {
      "given": {
        "price": 159.99,
        "pcs": 1500,
        "off": 20
      },
      "expect": {
        "paid": 127.992,
        "ppp": 0.085328,
        "cents": 8.5328
      },
      "source": "hand calculation in content.mdx: 159.99 × 0.80 = 127.992; 127.992 ÷ 1,500 = $0.085328; NIST SP 1181, Unit Pricing Guide: A Best Practice Approach to Unit Pricing (2025 edition) (best practice for unit pricing: the price per unit of measure, here per piece). https://www.nist.gov/publications/nist-sp-1181-unit-pricing-guide-best-practice-approach-unit-pricing-2025-ed, retrieved 2026-10-02"
    },
    {
      "given": {
        "price": 49.99,
        "pcs": 500,
        "price2": 99.99,
        "pcs2": 1200
      },
      "expect": {
        "ppp": 0.09998,
        "ppp2": 0.083325,
        "better": "The second set: 16.7% less per piece."
      },
      "source": "hand calculation in content.mdx: 49.99 ÷ 500 = $0.09998, 99.99 ÷ 1,200 = $0.083325; (0.09998 − 0.083325) ÷ 0.09998 = 16.7%; NIST SP 1181, Unit Pricing Guide: A Best Practice Approach to Unit Pricing (2025 edition) (best practice for unit pricing: the price per unit of measure, here per piece). https://www.nist.gov/publications/nist-sp-1181-unit-pricing-guide-best-practice-approach-unit-pricing-2025-ed, retrieved 2026-10-02"
    }
  ],
  "sources": [
    "NIST SP 1181, Unit Pricing Guide: A Best Practice Approach to Unit Pricing (2025 edition): unit pricing shows the price per unit of measure so shoppers can compare. https://www.nist.gov/publications/nist-sp-1181-unit-pricing-guide-best-practice-approach-unit-pricing-2025-ed (retrieved 2026-10-02)"
  ],
  "related": [
    "unit-price",
    "discount",
    "sales-tax"
  ],
  "changelog": []
}
