{"id":88,"date":"2026-10-18T17:53:16","date_gmt":"2026-10-18T17:53:16","guid":{"rendered":"https:\/\/refracttools.com\/blog\/?p=88"},"modified":"2026-10-18T17:53:16","modified_gmt":"2026-10-18T17:53:16","slug":"blurhash-vs-lqip","status":"publish","type":"post","link":"https:\/\/refracttools.com\/blog\/performance\/blurhash-vs-lqip\/","title":{"rendered":"BlurHash vs LQIP: image placeholders that feel faster"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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\u201330 characters that a small script turns back into pixels. LQIP (low-quality image placeholder) is a tiny image, usually 16\u201324 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-refract-takeaways is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\">Key takeaways<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Placeholders fill the empty space while photos load, which makes a page feel faster.<\/li>\n\n\n<li>BlurHash: ~20\u201330 characters, ideal for databases and APIs, needs a small decoder script.<\/li>\n\n\n<li>LQIP: a 16\u201324px image as a data URI, usually under 500 bytes, needs no JavaScript.<\/li>\n\n\n<li>A gradient or average colour costs almost nothing and suits grids of thumbnails.<\/li>\n\n\n<li>A placeholder doesn&#8217;t prevent layout shift on its own: you still need <code>width<\/code> and <code>height<\/code> or <code>aspect-ratio<\/code>.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Why use an image placeholder?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Placeholders don&#8217;t make images download any faster. For that, make the files smaller with the right size and format: see <a href=\"https:\/\/refracttools.com\/blog\/performance\/srcset-sizes-explained\/\">srcset and sizes<\/a> and the <a href=\"https:\/\/refracttools.com\/blog\/image-optimisation\/compress-images-for-website\/\">guide to compressing images<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">BlurHash vs LQIP vs gradient vs colour<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><div class=\"table-scroll\" tabindex=\"0\" role=\"region\" aria-label=\"Scrollable table\"><table><thead><tr><th>Placeholder<\/th><th>Size<\/th><th>Needs JavaScript<\/th><th>Best for<\/th><\/tr><\/thead><tbody><tr><td>BlurHash<\/td><td>~20\u201330 characters<\/td><td>Yes, to decode<\/td><td>Images listed by an API, app or CMS database<\/td><\/tr><tr><td>LQIP (tiny image)<\/td><td>Usually under 500 bytes<\/td><td>No<\/td><td>Static sites, hero and article images<\/td><\/tr><tr><td>CSS gradient<\/td><td>A few dozen bytes<\/td><td>No<\/td><td>Cards and thumbnails where shape doesn&#8217;t matter<\/td><\/tr><tr><td>Dominant colour<\/td><td>One hex value<\/td><td>No<\/td><td>Large grids, image-heavy feeds<\/td><\/tr><\/tbody><\/table><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How BlurHash works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import { decode } from \"blurhash\";\n\n\/\/ Turn the stored string into 32 \u00d7 32 pixels and paint them on a canvas\nconst pixels = decode(\"LEHV6nWB2yk8pyo0adR*.7kCMdnj\", 32, 32);\nconst canvas = document.querySelector(\"canvas.placeholder\");\nconst ctx = canvas.getContext(\"2d\");\nctx.putImageData(new ImageData(pixels, 32, 32), 0, 0);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The canvas is then stretched to the image&#8217;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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How LQIP works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An LQIP is the image itself, shrunk to around 16\u201324 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&#8217;s part of the HTML or CSS it appears with the first paint. No script is involved.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=\"photo\" style=\"background-image: url('data:image\/webp;base64,UklGR\u2026');\"&gt;\n  &lt;img src=\"\/img\/coast-1200.webp\" width=\"1200\" height=\"800\"\n       alt=\"Cliffs and sea at sunset\" loading=\"lazy\" decoding=\"async\"&gt;\n&lt;\/div&gt;\n\n.photo {\n  aspect-ratio: 3 \/ 2;\n  background-size: cover;\n  background-position: center;\n}\n.photo img {\n  display: block;\n  width: 100%;\n  height: auto;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n<aside class=\"tool-card tool-card--inline\"><span class=\"swatch\" style=\"background:linear-gradient(135deg,#7c9cff,#f5a35c)\" aria-hidden=\"true\"><\/span><div class=\"tool-card__body\"><p class=\"tool-card__eyebrow\">Free tool<\/p><p class=\"tool-card__name\">Blur placeholder generator<\/p><p class=\"tool-card__blurb\">BlurHash, tiny LQIP images and CSS gradients for loading states.<\/p><\/div><a class=\"btn primary\" href=\"https:\/\/refracttools.com\/blur-placeholder-generator\/\">Try it free <span aria-hidden=\"true\">\u2192<\/span><\/a><\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Gradients and dominant colours<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.card-image {\n  aspect-ratio: 4 \/ 3;\n  background: linear-gradient(135deg, #6b8fa3, #c9a27e, #3c4a5a);\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Avoiding layout shift<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A placeholder only helps if it occupies the right space. Always give the image or its wrapper its final shape before anything loads, with <code>width<\/code> and <code>height<\/code> attributes on the <code>&lt;img&gt;<\/code> or <code>aspect-ratio<\/code> in CSS. Without that, the page still jumps when the image arrives, placeholder or not, and your Cumulative Layout Shift score suffers.<\/p>\n\n\n\n<div class=\"wp-block-group is-style-refract-callout is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"wp-block-paragraph\"><strong>Tip:<\/strong> Using Next.js? It can create blur placeholders automatically for local images, but remote images need a <code>blurDataURL<\/code>. Paste the tiny image data URI from the generator into that prop.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Generate placeholders for your images<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Drop your images into the <a href=\"https:\/\/refracttools.com\/blur-placeholder-generator\/\">blur placeholder generator<\/a> 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&#8217;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 <a href=\"https:\/\/refracttools.com\/image-colour-palette\/\">colour palette from image<\/a> tool pulls out the main colours too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Sources: <a href=\"https:\/\/blurha.sh\/\" rel=\"noopener\" target=\"_blank\">BlurHash (Wolt)<\/a>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>BlurHash, LQIP, gradients or a single colour: how each image placeholder works, what it costs, and how to use them without layout shift.<\/p>\n","protected":false},"author":1,"featured_media":87,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_refract_tool":"blur-placeholder-generator","footnotes":""},"categories":[36],"tags":[43,5,17],"class_list":["post-88","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-performance","tag-image-placeholders","tag-image-tools","tag-performance"],"_links":{"self":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":1,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":117,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/posts\/88\/revisions\/117"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media\/87"}],"wp:attachment":[{"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/refracttools.com\/blog\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}