Performance

BlurHash vs LQIP: image placeholders that feel faster

BlurHash, LQIP, gradients or a single colour: how each image placeholder works, what it costs, and how to use them without layout shift.

BlurHash and LQIP are two ways to show a blurred preview while an image loads. BlurHash stores the preview as a short text string of about 20–30 characters that a small script turns back into pixels. LQIP (low-quality image placeholder) is a tiny image, usually 16–24 pixels wide and a few hundred bytes, embedded straight into the page as a data URI that works with plain CSS. Use BlurHash when previews come from a database or API, and LQIP when you want no JavaScript at all.

This guide compares the options, including the even lighter CSS gradient and single-colour placeholders, and shows how to use each without causing layout shift.

Key takeaways

  • Placeholders fill the empty space while photos load, which makes a page feel faster.
  • BlurHash: ~20–30 characters, ideal for databases and APIs, needs a small decoder script.
  • LQIP: a 16–24px image as a data URI, usually under 500 bytes, needs no JavaScript.
  • A gradient or average colour costs almost nothing and suits grids of thumbnails.
  • A placeholder doesn’t prevent layout shift on its own: you still need width and height or aspect-ratio.

Why use an image placeholder?

Images usually arrive last. Without a placeholder, people see empty boxes, or text that jumps as each picture appears. A blurred preview in the right colours fills that space immediately, so the page looks complete sooner and the final image fades into a shape the eye already expects.

Placeholders don’t make images download any faster. For that, make the files smaller with the right size and format: see srcset and sizes and the guide to compressing images.

BlurHash vs LQIP vs gradient vs colour

PlaceholderSizeNeeds JavaScriptBest for
BlurHash~20–30 charactersYes, to decodeImages listed by an API, app or CMS database
LQIP (tiny image)Usually under 500 bytesNoStatic sites, hero and article images
CSS gradientA few dozen bytesNoCards and thumbnails where shape doesn’t matter
Dominant colourOne hex valueNoLarge grids, image-heavy feeds

How BlurHash works

BlurHash was created by the delivery company Wolt. It breaks an image into a small number of smooth waves of colour, similar in spirit to how JPEG compression works, and keeps only the strongest few. Those values are packed into a short string. On the page, a decoder rebuilds a smooth, blurry image from the string at whatever size you need.

The number of components across and down controls how much shape the preview keeps. Four by three is a common default: enough to suggest a sky, a horizon and a subject. More components capture more detail but make the string longer.

import { decode } from "blurhash";

// Turn the stored string into 32 × 32 pixels and paint them on a canvas
const pixels = decode("LEHV6nWB2yk8pyo0adR*.7kCMdnj", 32, 32);
const canvas = document.querySelector("canvas.placeholder");
const ctx = canvas.getContext("2d");
ctx.putImageData(new ImageData(pixels, 32, 32), 0, 0);

The canvas is then stretched to the image’s size with CSS, and the real image is placed on top. Official decoders exist for JavaScript, Swift, Kotlin, Python and other languages, so the same string works on the web and in mobile apps.

How LQIP works

An LQIP is the image itself, shrunk to around 16–24 pixels wide and saved as a base64 data URI. Browsers smooth small images when they stretch them, so it already looks blurred, and because it’s part of the HTML or CSS it appears with the first paint. No script is involved.

<div class="photo" style="background-image: url('data:image/webp;base64,UklGR…');">
  <img src="/img/coast-1200.webp" width="1200" height="800"
       alt="Cliffs and sea at sunset" loading="lazy" decoding="async">
</div>

.photo {
  aspect-ratio: 3 / 2;
  background-size: cover;
  background-position: center;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
}

The trade-off is weight in your HTML. A few hundred bytes per image is fine for a handful of photos, but on a page with a hundred thumbnails it adds up, and a gradient or single colour is the better choice there.

Gradients and dominant colours

The lightest placeholders are a three-colour CSS gradient taken from the image, or just its average colour. They hint at the picture without showing any shape, which is plenty for product grids, galleries and avatars. A colour also suits dark mode better than a grey box.

.card-image {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #6b8fa3, #c9a27e, #3c4a5a);
}

Avoiding layout shift

A placeholder only helps if it occupies the right space. Always give the image or its wrapper its final shape before anything loads, with width and height attributes on the <img> or aspect-ratio in CSS. Without that, the page still jumps when the image arrives, placeholder or not, and your Cumulative Layout Shift score suffers.

Tip: Using Next.js? It can create blur placeholders automatically for local images, but remote images need a blurDataURL. Paste the tiny image data URI from the generator into that prop.

Generate placeholders for your images

Drop your images into the blur placeholder generator to see all four placeholders side by side at the right aspect ratio. Adjust the BlurHash detail and tiny-image width, then copy the code or export every image’s hash, data URI, gradient and colour as JSON for a build script or CMS. It follows the published BlurHash algorithm, so the strings decode with the official libraries, and nothing is uploaded. For a single dominant colour to use elsewhere in your design, the colour palette from image tool pulls out the main colours too.

Sources: BlurHash (Wolt).