DevTools Logo

BlurHash Generator

BlurHash Generator

Encode an image into a compact BlurHash string and verify it with a live decode preview.

Runs in your browser
Try an example

Source image

The BlurHash DCT runs entirely in this browser tab; images are downscaled to at most 128 px before encoding and are never uploaded. The preview is produced by decoding the hash itself, not by showing the source image.

Hash length: 28 characters

Paste a hash to preview it.

BlurHash

No hash yet

Load an image and press Encode.

Examples

Article card

Input
4×3 components, 128 px downscale
Output
27-character hash

A compact placeholder that preserves the dominant colour and broad gradients.

Cover art

Input
6×4 components
Output
51-character hash

Extra components retain diagonal colour transitions in a complex image.

Truncated hash

Input
Paste LEHV6eWB4k
Output
Expected-length error

Validation reports how many characters the declared component grid requires.

About this tool

BlurHash encodes a blurred impression of an image into a short base83 string that a client can decode before the full image loads. This tool implements the algorithm locally: it downscales the source, converts sRGB to linear light and computes the discrete cosine basis for the selected number of x and y components.

The DC term carries the average colour; each AC term is normalised by the largest coefficient, quantised on a 19-step signed scale and packed into two base83 characters. The header packs the component counts into the first character, and the string length is 2·x·y + 3 characters.

The preview is deliberately decoded from the produced hash rather than drawn from the source image. That round-trip shows approximately what an app-side decoder will render, and an existing hash can be pasted in to validate and preview it. Light and dark backdrops help check how the placeholder will look in a themed interface.

What this tool does not do

  • The alpha channel is ignored; transparent regions are treated as their underlying RGB values.
  • Decoded previews are blurred approximations, not recoverable full-resolution images.
  • Different browser image decoders can produce slightly different hashes for the same file.

How to use this tool

  1. Load an image

    Choose a PNG, JPEG or WebP file, or click a sample chip. The image is downscaled before any DCT work.

  2. Set components

    Move the x and y component sliders (1–9 each, product at most 74). More components retain more structure at the cost of a longer string.

  3. Encode

    Press Encode to compute the hash. The panel shows its exact character count and validation state.

  4. Verify or copy

    Inspect the preview decoded from the hash, switch backdrops, paste an external hash to check it, then copy the string.

Use cases

Image placeholders

Show a coloured blur while a large hero image is still downloading.

Design handoff

Copy a verified hash with a preview that matches what an app-side decoder will draw.

Hash debugging

Paste a hash from a feed or CMS and see whether it is structurally valid.

Component grids

GridCharacters
1×15 — average colour plus the size flag
4×327 — common article placeholder
6×451 — more directional detail
9×8147 — largest permitted grid (x·y ≤ 74)

The string length is 2·x·y + 3; the preview always decodes the hash itself, not the original pixels.

Common mistakes

Mistake:Expecting the hash to preserve the original aspect ratio.

Fix:BlurHash stores no dimensions; keep width and height alongside the string in your application.

Mistake:Using very high component counts on a flat image.

Fix:Flat images gain nothing from a large grid and produce a much longer string.

Mistake:Comparing the preview to the source pixel-for-pixel.

Fix:The preview is a low-frequency reconstruction decoded from the hash, so fine detail and steep gradients are intentionally approximate.

Frequently asked questions

How long is a BlurHash string and why?

A hash is 2·x·y + 3 characters: one for the component grid, four for the average colour, and two for each AC component except the DC term. A 4×3 hash is 27 characters, a 6×4 hash is 51, and a 1×1 hash is five characters of average colour plus its size flag.

What do the x and y components control?

They set the number of cosine basis functions per horizontal and vertical axis. More components preserve more directional colour variation but lengthen the string. Each value is between 1 and 9 and the product must not exceed 74; most interfaces use 4×3 or 6×4.

Why does my hash decode darker or lighter than the original?

BlurHash works in linear light and stores only low-frequency coefficients, so bright small details are averaged away and steep gradients can look different. Different browser decoders and JPEG colour handling can also shift the result slightly. The preview here uses the same string your app will decode.

Can I decode a hash back to a full image?

No. A hash contains a few colour components and no pixel detail, aspect ratio or alpha channel. It can only produce a blurred approximation, which is exactly what a placeholder needs.

Is my image uploaded?

No. Downscaling, DCT encoding and the decode preview all run in this tab. The image bytes are not stored and never leave your browser; pasted hashes are only parsed locally.

Does the tool support transparent PNGs?

BlurHash has no alpha channel, so transparency is ignored and treated as the underlying RGB data. Flatten logos onto a chosen background before encoding if their transparent areas must look a specific colour.