Skip to main content

How to find the font size from a screenshot

Drop the screenshot into Datum and click “Extract Text”: it measures every text line’s glyph height and stroke thickness and reports the font size (±1px for 93.1% of words), weight and exact hex colour. It runs free in your browser and nothing is uploaded.

Why this is hard (and why colour pickers don’t help)

Colour pickers can tell you a pixel’s hex code, and browser extensions can read font sizes from a live web page. But a screenshot has no CSS left in it — only pixels. Most tools, and AI models looking at the image, end up guessing: “looks like text-sm”. When you rebuild a design with Claude Code or Cursor, those guesses add up to a UI that feels slightly off everywhere.

How Datum measures font size from pixels

  1. Find the text. Local OCR (tuned for UI: 2× upscaling, sparse-text segmentation and a second pass for labels on coloured buttons) locates each line and word. It recovered 93.9% of visible words on our benchmark.
  2. Separate ink from background. The background is the dominant colour around the line; text pixels are those that differ from it.
  3. Measure glyph height. Words with capitals or digits are measured by cap height (≈0.72 em), lowercase-only words by x-height (≈0.53 em), and descenders (g, p, y) are accounted for. The median across a line’s words gives its font size.
  4. Measure weight and colour. Stroke thickness relative to size separates regular from bold. Colour is measured per RGB channel, which keeps it exact even with Windows ClearType sub-pixel rendering.

Step by step

  1. Open the converter. Go to the free Datum converter in your browser. Nothing is uploaded; analysis runs locally.
  2. Drop the screenshot. Drop or paste a PNG or JPEG of the UI. Use a 1× or 2× screenshot, not a resized or compressed copy.
  3. Extract text. Click “Extract Text”. Datum finds every text line and measures its glyph height, stroke weight and colour.
  4. Read the type scale. Open the generated prompt: the Typography Scale lists each font size, weight and hex colour, and the layout tree shows them per line.

What you get

A type scale you can paste straight into Tailwind or CSS variables, for example:

| Style  | Font Size | Weight  | Text Colour |
| text-1 | 28px      | bold    | #FAFAFA     |
| text-2 | 17px      | bold    | #FAFAFA     |
| text-3 | 13px      | regular | #A1A1AA     |

Each line also appears in a layout tree inside the card it belongs to, so your agent knows that the 13px grey label sits above the 28px bold value in the same card.

Accuracy, measured honestly

MeasurementResult
Font size within ±1px93.1% of words
Font weight (regular / bold)92.8% correct
Text colour within ΔE 398.6% of words
Words recovered93.9%

10 reference UIs rendered in Chrome; ground truth read from the live DOM (text, computed colours, font sizes, element boxes) and compared with what Datum extracts from the screenshot alone.

Questions

Can you get the exact font size from an image?
Yes, to within about a pixel. Datum measures the height of the glyphs in each text line (cap height for capitals and digits, x-height for lowercase, plus descenders) and converts it to a CSS font size. On our benchmark 93.1% of words were within ±1px of the real CSS value.
Does it work on 2× (retina) screenshots?
Yes, but the measured size is in screenshot pixels. Divide by 2 for a 2× screenshot to get CSS pixels. The prompt states the image dimensions so your coding agent can make the same conversion.
Can it identify the font family?
No. Pixel measurement gives size, weight and colour reliably, but not the typeface name. Datum tells your agent to use your project’s font instead of guessing one.
How do I get the font weight from a screenshot?
Datum measures stroke thickness relative to the font size and reports regular (≈400–500) or bold (≈600–800). It was correct for 92.8% of words on our benchmark. It does not distinguish 400 from 500 because the difference is below a pixel at UI sizes.