[{"data":1,"prerenderedAt":565},["ShallowReactive",2],{"guide-base64-vs-image-cdn":3},{"id":4,"title":5,"body":6,"date":555,"description":556,"extension":557,"meta":558,"navigation":559,"path":560,"readingTime":561,"seo":562,"stem":563,"__hash__":564},"guides\u002Fguides\u002Fbase64-vs-image-cdn.md","Base64 vs Image CDN: Which Delivers Faster Pages?",{"type":7,"value":8,"toc":543},"minimark",[9,13,18,21,81,84,113,117,120,147,149,175,179,182,264,272,276,279,340,343,347,354,357,364,406,410,413,439,442,446,449,481,485,502,506,527,531,539],[10,11,12],"p",{},"Base64 inline images and image CDNs take opposite approaches to image delivery. One embeds the image data directly in your HTML or CSS; the other serves optimized images from a global distribution network. Understanding when each technique wins helps you build faster pages without guessing.",[14,15,17],"h2",{"id":16},"how-base64-inline-images-work","How Base64 Inline Images Work",[10,19,20],{},"Base64 encoding converts binary image data into an ASCII string embedded in your HTML or CSS as a data URI. The browser decodes it inline — no separate network request needed.",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-html shiki shiki-themes github-light github-dark","\u003Cimg src=\"data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUg...\" alt=\"Icon\" width=\"16\" height=\"16\">\n","html","",[29,30,31],"code",{"__ignoreMap":27},[32,33,36,40,44,48,51,55,58,60,63,66,68,71,74,76,78],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"sVt8B","\u003C",[32,41,43],{"class":42},"s9eBZ","img",[32,45,47],{"class":46},"sScJk"," src",[32,49,50],{"class":38},"=",[32,52,54],{"class":53},"sZZnC","\"data:image\u002Fpng;base64,iVBORw0KGgoAAAANSUhEUg...\"",[32,56,57],{"class":46}," alt",[32,59,50],{"class":38},[32,61,62],{"class":53},"\"Icon\"",[32,64,65],{"class":46}," width",[32,67,50],{"class":38},[32,69,70],{"class":53},"\"16\"",[32,72,73],{"class":46}," height",[32,75,50],{"class":38},[32,77,70],{"class":53},[32,79,80],{"class":38},">\n",[10,82,83],{},"Key characteristics:",[85,86,87,95,101,107],"ul",{},[88,89,90,94],"li",{},[91,92,93],"strong",{},"Zero additional requests"," — the image travels with the document or stylesheet",[88,96,97,100],{},[91,98,99],{},"33% size overhead"," — Base64 encoding expands binary data by roughly one-third",[88,102,103,106],{},[91,104,105],{},"No independent caching"," — the image is cached as part of the parent file",[88,108,109,112],{},[91,110,111],{},"Blocks rendering"," — the browser cannot display the image until it finishes decoding the containing resource",[14,114,116],{"id":115},"how-image-cdns-work","How Image CDNs Work",[10,118,119],{},"Image CDNs (Cloudinary, Imgix, Fastly IO, Next.js Image Optimization) store your original images and serve transformed versions on the fly. They resize, compress, and convert formats based on the requesting device.",[22,121,123],{"className":24,"code":122,"language":26,"meta":27,"style":27},"\u003Cimg src=\"https:\u002F\u002Fcdn.example.com\u002Fphoto.jpg?w=400&q=75&f=webp\" alt=\"Product photo\">\n",[29,124,125],{"__ignoreMap":27},[32,126,127,129,131,133,135,138,140,142,145],{"class":34,"line":35},[32,128,39],{"class":38},[32,130,43],{"class":42},[32,132,47],{"class":46},[32,134,50],{"class":38},[32,136,137],{"class":53},"\"https:\u002F\u002Fcdn.example.com\u002Fphoto.jpg?w=400&q=75&f=webp\"",[32,139,57],{"class":46},[32,141,50],{"class":38},[32,143,144],{"class":53},"\"Product photo\"",[32,146,80],{"class":38},[10,148,83],{},[85,150,151,157,163,169],{},[88,152,153,156],{},[91,154,155],{},"Optimized per device"," — serves WebP\u002FAVIF to supporting browsers, resized to exact display dimensions",[88,158,159,162],{},[91,160,161],{},"Global edge caching"," — images cached at CDN nodes close to users worldwide",[88,164,165,168],{},[91,166,167],{},"Independent caching"," — images cache separately from HTML\u002FCSS, surviving deployments",[88,170,171,174],{},[91,172,173],{},"Additional requests"," — each image requires a separate HTTP request (mitigated by HTTP\u002F2 multiplexing)",[14,176,178],{"id":177},"bandwidth-and-size-comparison","Bandwidth and Size Comparison",[10,180,181],{},"Consider a typical product image (original: 150 KB JPEG):",[183,184,185,204],"table",{},[186,187,188],"thead",{},[189,190,191,195,198,201],"tr",{},[192,193,194],"th",{},"Delivery Method",[192,196,197],{},"Format",[192,199,200],{},"Size",[192,202,203],{},"Overhead",[205,206,207,222,236,250],"tbody",{},[189,208,209,213,216,219],{},[210,211,212],"td",{},"Original JPEG",[210,214,215],{},"JPEG",[210,217,218],{},"150 KB",[210,220,221],{},"—",[189,223,224,227,230,233],{},[210,225,226],{},"Base64 inline",[210,228,229],{},"Base64 JPEG",[210,231,232],{},"200 KB",[210,234,235],{},"+33%",[189,237,238,241,244,247],{},[210,239,240],{},"Image CDN (WebP, resized)",[210,242,243],{},"WebP",[210,245,246],{},"35 KB",[210,248,249],{},"-77%",[189,251,252,255,258,261],{},[210,253,254],{},"Image CDN (AVIF, resized)",[210,256,257],{},"AVIF",[210,259,260],{},"20 KB",[210,262,263],{},"-87%",[10,265,266,267,271],{},"The image CDN delivers the same visual quality at a fraction of the size. Base64 makes the image ",[268,269,270],"em",{},"larger"," than the original. For any image over a few kilobytes, the CDN wins decisively.",[14,273,275],{"id":274},"caching-behavior","Caching Behavior",[10,277,278],{},"Caching strategy determines repeat-visit performance:",[183,280,281,294],{},[186,282,283],{},[189,284,285,288,291],{},[192,286,287],{},"Aspect",[192,289,290],{},"Base64 Inline",[192,292,293],{},"Image CDN",[205,295,296,307,318,329],{},[189,297,298,301,304],{},[210,299,300],{},"Cache scope",[210,302,303],{},"Cached with HTML or CSS",[210,305,306],{},"Cached independently",[189,308,309,312,315],{},[210,310,311],{},"Cache duration",[210,313,314],{},"Matches parent file (hours–days)",[210,316,317],{},"Typically 30–365 days",[189,319,320,323,326],{},[210,321,322],{},"Deploy impact",[210,324,325],{},"New deploy = re-download all inline images",[210,327,328],{},"Images survive CSS\u002FHTML updates",[189,330,331,334,337],{},[210,332,333],{},"Purge control",[210,335,336],{},"No — tied to parent cache key",[210,338,339],{},"Yes — CDN invalidation API",[10,341,342],{},"For frequently-deployed applications, Base64 inlining forces users to re-download unchanged images with every deploy. Image CDNs cache images independently, so a CSS update does not bust the image cache.",[14,344,346],{"id":345},"rendering-performance","Rendering Performance",[10,348,349,350,353],{},"Base64 images in HTML block the HTML parser. The browser must decode the Base64 string before it can continue parsing the rest of the document. A 100 KB Base64 image in the ",[29,351,352],{},"\u003Chead>"," delays the entire page.",[10,355,356],{},"Base64 images in CSS block the stylesheet's rendering. The browser cannot paint elements that depend on the background image until the CSS file — including the embedded Base64 string — downloads and parses.",[10,358,359,360,363],{},"CDN images load asynchronously. The browser continues parsing HTML while fetching images in parallel. With ",[29,361,362],{},"loading=\"lazy\"",", off-screen images do not even start downloading until the user scrolls near them.",[22,365,367],{"className":24,"code":366,"language":26,"meta":27,"style":27},"\u003C!-- Async, lazy-loaded — does not block rendering -->\n\u003Cimg src=\"https:\u002F\u002Fcdn.example.com\u002Fphoto.webp\" loading=\"lazy\" alt=\"Product\">\n",[29,368,369,375],{"__ignoreMap":27},[32,370,371],{"class":34,"line":35},[32,372,374],{"class":373},"sJ8bj","\u003C!-- Async, lazy-loaded — does not block rendering -->\n",[32,376,378,380,382,384,386,389,392,394,397,399,401,404],{"class":34,"line":377},2,[32,379,39],{"class":38},[32,381,43],{"class":42},[32,383,47],{"class":46},[32,385,50],{"class":38},[32,387,388],{"class":53},"\"https:\u002F\u002Fcdn.example.com\u002Fphoto.webp\"",[32,390,391],{"class":46}," loading",[32,393,50],{"class":38},[32,395,396],{"class":53},"\"lazy\"",[32,398,57],{"class":46},[32,400,50],{"class":38},[32,402,403],{"class":53},"\"Product\"",[32,405,80],{"class":38},[14,407,409],{"id":408},"when-base64-wins","When Base64 Wins",[10,411,412],{},"Despite the trade-offs, Base64 has legitimate use cases:",[85,414,415,421,427,433],{},[88,416,417,420],{},[91,418,419],{},"Tiny icons under 2 KB"," — the request overhead (headers, TLS handshake) may exceed the 33% encoding penalty",[88,422,423,426],{},[91,424,425],{},"Critical above-the-fold icons"," — one or two small icons that must appear instantly with no request waterfall",[88,428,429,432],{},[91,430,431],{},"Email HTML"," — most email clients block external images; Base64 may work depending on the client",[88,434,435,438],{},[91,436,437],{},"Single-file deliverables"," — standalone HTML reports or documents that must work offline without external dependencies",[10,440,441],{},"Even in these cases, SVG inline markup usually beats Base64 for vector icons.",[14,443,445],{"id":444},"when-image-cdn-wins","When Image CDN Wins",[10,447,448],{},"Image CDN is the better choice for nearly everything else:",[85,450,451,457,463,469,475],{},[88,452,453,456],{},[91,454,455],{},"Photographs and complex images"," — format optimization (WebP, AVIF) saves 50–80%",[88,458,459,462],{},[91,460,461],{},"Responsive images"," — serving different sizes for mobile vs. desktop",[88,464,465,468],{},[91,466,467],{},"Sites with frequent deploys"," — independent caching preserves image cache",[88,470,471,474],{},[91,472,473],{},"Global audiences"," — edge caching reduces latency for users far from your origin",[88,476,477,480],{},[91,478,479],{},"Any image over 5 KB"," — the size penalty and parsing cost outweigh request savings",[14,482,484],{"id":483},"key-takeaways","Key Takeaways",[85,486,487,490,493,496,499],{},[88,488,489],{},"Base64 adds ~33% size overhead with no format optimization; image CDNs typically reduce size by 50–80%",[88,491,492],{},"Image CDNs cache independently, surviving HTML\u002FCSS deploys; Base64 images re-download with every parent file update",[88,494,495],{},"Base64 blocks HTML parsing or CSS rendering; CDN images load asynchronously with lazy-loading support",[88,497,498],{},"Use Base64 only for icons under 2 KB, email HTML, or single-file deliverables",[88,500,501],{},"For everything else, an image CDN delivers smaller files, better caching, and faster rendering",[14,503,505],{"id":504},"related-guides","Related Guides",[85,507,508,515,521],{},[88,509,510],{},[511,512,514],"a",{"href":513},"\u002Fguides\u002Fimage-to-base64-guide","Image to Base64: Converting Images for Inline Embedding",[88,516,517],{},[511,518,520],{"href":519},"\u002Fguides\u002Fdata-uri-performance","Data URI Performance: Measuring the Real Cost of Inlining",[88,522,523],{},[511,524,526],{"href":525},"\u002Fguides\u002Fbase64-image-optimization","Base64 Image Optimization: Reducing Inline Image Overhead",[14,528,530],{"id":529},"try-it-yourself","Try It Yourself",[10,532,533,534,538],{},"Convert images to Base64 for small icon inlining with our free ",[511,535,537],{"href":536},"\u002Ftools\u002Fimage-to-base64","Image to Base64"," tool. Upload any image, get the encoded string, and measure whether inlining makes sense for your use case.",[540,541,542],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":27,"searchDepth":377,"depth":377,"links":544},[545,546,547,548,549,550,551,552,553,554],{"id":16,"depth":377,"text":17},{"id":115,"depth":377,"text":116},{"id":177,"depth":377,"text":178},{"id":274,"depth":377,"text":275},{"id":345,"depth":377,"text":346},{"id":408,"depth":377,"text":409},{"id":444,"depth":377,"text":445},{"id":483,"depth":377,"text":484},{"id":504,"depth":377,"text":505},{"id":529,"depth":377,"text":530},"2026-05-28","Compare Base64 inline images and image CDNs — bandwidth cost, caching behavior, rendering speed, and when each approach wins for web performance.","md",{"immutable":559},true,"\u002Fguides\u002Fbase64-vs-image-cdn",6,{"title":5,"description":556},"guides\u002Fbase64-vs-image-cdn","xEIkUU5Gg_pQQtH0Gdo1aRMqi-uyXUKiH9XhynaFWPM",1780401331702]