{
  "id": "ppi",
  "version": "b251cfbefc4c",
  "status": "published",
  "name": "PPI Calculator",
  "question": "What is my screen’s PPI?",
  "summary": "Computes a screen’s pixel density in pixels per inch (PPI) from its resolution and diagonal size, with the dot pitch, the screen’s width and height, and its aspect ratio.",
  "category": "logic",
  "url": "https://www.acalculator.org/logic/ppi-calculator",
  "markdown": "https://www.acalculator.org/logic/ppi-calculator.md",
  "kind": "function",
  "method": "PPI = √(width² + height²) ÷ diagonal (inches); dot pitch = 25.4 ÷ PPI mm; screen width = diagonal × width ÷ √(width² + height²).",
  "assumptions": [
    "Pixels are square, so the same density holds across and down the screen.",
    "The diagonal is the visible area, corner to corner; screens with rounded corners are measured as the full rectangle."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "w": {
        "title": "Horizontal pixels",
        "description": "The screen’s width in pixels, for example 1920.",
        "type": "integer",
        "minimum": 1,
        "maximum": 100000
      },
      "h": {
        "title": "Vertical pixels",
        "description": "The screen’s height in pixels, for example 1080.",
        "type": "integer",
        "minimum": 1,
        "maximum": 100000
      },
      "d": {
        "title": "Diagonal size",
        "description": "The screen size, measured corner to corner across the visible area.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.00254,
        "maximum": 25.400000000000002
      }
    }
  },
  "outputs": {
    "ppi": {
      "label": "Pixel density",
      "description": "√(width² + height²) ÷ diagonal in inches.",
      "format": "number"
    },
    "pitch": {
      "label": "Dot pitch",
      "description": "The distance between pixel centres: 25.4 mm ÷ PPI.",
      "format": "number"
    },
    "diagonalPixels": {
      "label": "Diagonal in pixels",
      "description": "√(width² + height²).",
      "format": "number"
    },
    "screenWidth": {
      "label": "Screen width",
      "description": "Diagonal × width ÷ diagonal in pixels.",
      "format": "quantity",
      "unit": "in"
    },
    "screenHeight": {
      "label": "Screen height",
      "description": "Diagonal × height ÷ diagonal in pixels.",
      "format": "quantity",
      "unit": "in"
    },
    "aspect": {
      "label": "Aspect ratio",
      "description": "Width : height in lowest terms.",
      "format": "text"
    },
    "megapixels": {
      "label": "Total pixels",
      "description": "Width × height, in millions.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "w": 1920,
      "h": 1080,
      "d": 0.6095999999999999
    },
    "outputs": {
      "ppi": 91.78779875342912,
      "pitch": 0.2767252330370443,
      "diagonalPixels": 2202.9071700822983,
      "screenWidth": 0.5313124474311252,
      "screenHeight": 0.29886325168000794,
      "aspect": "16:9",
      "megapixels": 2.0736
    },
    "text": "A 24 in screen at 1,920 × 1,080 pixels has 91.79 pixels per inch."
  },
  "examples": [
    {
      "given": {
        "w": 1920,
        "h": 1080,
        "d": 0.6095999999999999
      },
      "expect": {
        "ppi": 91.7877987534291,
        "pitch": 0.2767252330370444,
        "diagonalPixels": 2202.9071700822983,
        "aspect": "16:9",
        "megapixels": 2.0736
      },
      "source": "hand calculation in content.mdx: √(1920² + 1080²) = 2,202.91 ÷ 24 = 91.79 PPI; NIST SP 811, Appendix B (1 in = 25.4 mm exactly), https://www.nist.gov/pml/special-publication-811",
      "tolerance": 1e-12
    },
    {
      "given": {
        "w": 2556,
        "h": 1179,
        "d": 0.155448
      },
      "expect": {
        "ppi": 460
      },
      "source": "Apple, iPhone 15 Technical Specifications (6.1-inch display, 6.12 in as a rectangle; 2556 × 1179 pixels at 460 ppi), https://support.apple.com/en-us/111831 (460 ppi, rounded to a whole ppi, so within 0.5 ÷ 460); hand calculation in content.mdx: √(2556² + 1179²) = 2,814.8 ÷ 6.12 = 459.9",
      "tolerance": 0.0011
    },
    {
      "given": {
        "w": 3840,
        "h": 2160,
        "d": 0.6858
      },
      "expect": {
        "ppi": 163.17830889498507,
        "screenWidth": 0.5977265033600159
      },
      "source": "hand calculation in content.mdx: √(3840² + 2160²) = 4,405.81 ÷ 27 = 163.18 PPI; width 27 × 3840 ÷ 4,405.81 = 23.53 in; NIST SP 811, https://www.nist.gov/pml/special-publication-811",
      "tolerance": 1e-12
    }
  ],
  "sources": [
    "Apple, iPhone 15 Technical Specifications: 6.1-inch (diagonal) display, 6.12 inches as a standard rectangle; 2556-by-1179-pixel resolution at 460 ppi. https://support.apple.com/en-us/111831 (retrieved 2026-10-01)",
    "NIST Special Publication 811, Appendix B: 1 in = 2.54 cm = 25.4 mm exactly. https://www.nist.gov/pml/special-publication-811 (retrieved 2026-10-01)"
  ],
  "related": [
    "aspect-ratio",
    "dpi"
  ],
  "changelog": []
}
