{
  "id": "dpi",
  "version": "ba208f30575f",
  "status": "published",
  "name": "DPI Calculator",
  "question": "What DPI will my print have?",
  "summary": "Works out the print resolution in dots per inch (DPI) of an image from its pixels and the print size, the largest print at a target DPI, and the pixels a print size needs.",
  "category": "logic",
  "url": "https://www.acalculator.org/logic/dpi-calculator",
  "markdown": "https://www.acalculator.org/logic/dpi-calculator.md",
  "kind": "function",
  "method": "DPI across = pixel width ÷ print width (in); DPI down = pixel height ÷ print height (in); print resolution = the lower; largest print = pixels ÷ target DPI; pixels needed = ⌈print size (in) × target DPI⌉.",
  "assumptions": [
    "The image fills the print without cropping or borders; when its shape differs from the print, the lower DPI applies to the whole print.",
    "DPI here means image pixels per printed inch (also called PPI); a printer’s own ink dots per inch are a separate setting."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "pw": {
        "title": "Image width (pixels)",
        "description": "The width of the image in pixels.",
        "type": "integer",
        "minimum": 1,
        "maximum": 1000000
      },
      "ph": {
        "title": "Image height (pixels)",
        "description": "The height of the image in pixels.",
        "type": "integer",
        "minimum": 1,
        "maximum": 1000000
      },
      "w": {
        "title": "Print width",
        "description": "The width of the print.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.001,
        "maximum": 100
      },
      "h": {
        "title": "Print height",
        "description": "The height of the print.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "minimum": 0.001,
        "maximum": 100
      },
      "t": {
        "title": "Target DPI",
        "description": "The resolution you want the print to have: 300 is a common choice for photos.",
        "type": "number",
        "minimum": 1,
        "maximum": 10000
      }
    }
  },
  "outputs": {
    "dpi": {
      "label": "Print resolution",
      "description": "The lower of the DPI across and down: what the whole print gets.",
      "format": "number"
    },
    "dpiWidth": {
      "label": "DPI across",
      "description": "Image width in pixels ÷ print width in inches.",
      "format": "number"
    },
    "dpiHeight": {
      "label": "DPI down",
      "description": "Image height in pixels ÷ print height in inches.",
      "format": "number"
    },
    "maxWidthIn": {
      "label": "Largest print width at the target (in)",
      "description": "Image width ÷ target DPI, in inches.",
      "format": "number"
    },
    "maxHeightIn": {
      "label": "Largest print height at the target (in)",
      "description": "Image height ÷ target DPI, in inches.",
      "format": "number"
    },
    "maxWidthCm": {
      "label": "Largest print width at the target (cm)",
      "description": "Image width ÷ target DPI × 2.54, in centimetres.",
      "format": "number"
    },
    "maxHeightCm": {
      "label": "Largest print height at the target (cm)",
      "description": "Image height ÷ target DPI × 2.54, in centimetres.",
      "format": "number"
    },
    "needWidth": {
      "label": "Pixels needed across",
      "description": "Print width × target DPI, rounded up.",
      "format": "integer"
    },
    "needHeight": {
      "label": "Pixels needed down",
      "description": "Print height × target DPI, rounded up.",
      "format": "integer"
    },
    "enough": {
      "label": "Meets the target?",
      "description": "Yes when the print resolution is at least the target DPI.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "pw": 3000,
      "ph": 2400,
      "w": 0.254,
      "h": 0.2032,
      "t": 300
    },
    "outputs": {
      "dpi": 300,
      "dpiWidth": 300,
      "dpiHeight": 300,
      "maxWidthIn": 10,
      "maxHeightIn": 8,
      "maxWidthCm": 25.4,
      "maxHeightCm": 20.32,
      "needWidth": 3000,
      "needHeight": 2400,
      "enough": "Yes"
    },
    "text": "A 3,000 × 2,400 pixel image printed 10 in × 8 in has 300 DPI."
  },
  "examples": [
    {
      "given": {
        "pw": 3000,
        "ph": 2400,
        "w": 0.254,
        "h": 0.2032,
        "t": 300
      },
      "expect": {
        "dpi": 300,
        "dpiWidth": 300,
        "dpiHeight": 300,
        "needWidth": 3000,
        "needHeight": 2400,
        "enough": "Yes"
      },
      "source": "ScanTips, Printing and Scanning Resolution DPI Calculator (print size = pixels ÷ resolution), https://www.scantips.com/calc.html (3,000 pixels at 300 dpi prints 10 inches); hand calculation in content.mdx: 3,000 ÷ 10 = 300, 2,400 ÷ 8 = 300"
    },
    {
      "given": {
        "pw": 1500,
        "ph": 1200,
        "w": 0.254,
        "h": 0.2032,
        "t": 300
      },
      "expect": {
        "dpi": 150,
        "maxWidthIn": 5,
        "maxHeightIn": 4,
        "maxWidthCm": 12.7,
        "enough": "No"
      },
      "source": "ScanTips, Printing and Scanning Resolution DPI Calculator (print size = pixels ÷ resolution), https://www.scantips.com/calc.html; hand calculation in content.mdx: 1,500 ÷ 10 = 150 DPI; 1,500 ÷ 300 = 5 in, 1,200 ÷ 300 = 4 in"
    },
    {
      "given": {
        "pw": 4000,
        "ph": 3000,
        "w": 0.2,
        "h": 0.15,
        "t": 300
      },
      "expect": {
        "dpi": 508,
        "needWidth": 2363,
        "needHeight": 1772
      },
      "source": "ScanTips, Printing and Scanning Resolution DPI Calculator (print size = pixels ÷ resolution), https://www.scantips.com/calc.html; hand calculation in content.mdx: 20 cm = 7.874 in; 4,000 ÷ 7.874 = 508 DPI; 7.874 × 300 = 2,362.2 → 2,363 px"
    },
    {
      "given": {
        "pw": 3000,
        "ph": 2000,
        "w": 0.254,
        "h": 0.2032,
        "t": 300
      },
      "expect": {
        "dpiWidth": 300,
        "dpiHeight": 250,
        "dpi": 250,
        "enough": "No"
      },
      "source": "ScanTips, Printing and Scanning Resolution DPI Calculator (print size = pixels ÷ resolution), https://www.scantips.com/calc.html; hand calculation in content.mdx: 2,000 ÷ 8 = 250 DPI down, the lower of the two"
    }
  ],
  "sources": [
    "ScanTips, Printing and Scanning Resolution DPI Calculator: print size in inches = pixels ÷ resolution (3,000 pixels at 300 dpi print 10 inches). https://www.scantips.com/calc.html (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": [
    "ppi",
    "aspect-ratio",
    "edpi"
  ],
  "changelog": []
}
