How to Optimize Images for Apple Retina and High-DPI Screens Without Bloating Page Weight
Summary
Serve images at twice their display size, but at a much lower quality setting, and let srcset pick the file. How to get sharp Retina images that weigh little more than 1x ones.
To look sharp on a Retina or other high-density screen, an image needs about twice as many pixels across as the space it fills on the page. The way to do that without doubling page weight is to compress the 2x file much harder than you would a normal one. On a dense screen each pixel is tiny, so artifacts that are obvious at 1x are hard to see, and a 2x image at low quality often weighs little more than a 1x image at high quality.
Add srcset so each screen gets the file it needs, cap at 2x, and use SVG for anything that is not a photo. The details follow.

Why a 1x image looks soft on a MacBook or iPhone
Web layouts are measured in CSS pixels. A screen's device pixel ratio says how many physical pixels make up one CSS pixel across. Most Retina Macs and many iPhones are 2x; the larger and Pro iPhones are 3x. You can check any device by typing window.devicePixelRatio in the browser console.
An image placed in a 600 CSS pixel slot on a 2x screen has 1200 physical pixels to fill. If the file is only 600 pixels wide, the browser stretches it, and edges, text and fine texture go soft. Give it a 1200 pixel file and it is sharp.
The cost is real. Doubling the width and height quadruples the pixel count, and a 3x image has 2.25 times the pixels of a 2x one. Saved at the same quality, file size roughly follows.
Compress 2x images much harder
Here is the part most guides skip. The quality setting you use for 1x images is wasted on 2x images. Jake Archibald's test on a WebP photo shows the effect: the 1x version at quality 80 was 14.9 kB, the 2x version at the same quality 45.2 kB, and the 2x version at quality 44 was 21.2 kB while still looking sharp at display size. The Filament Group described the same effect years earlier for JPEG and called it compressive images.
- 1.Export the image at twice the largest width it is shown at. A hero that is never wider than 800 CSS pixels needs a 1600 pixel file.
- 2.Open it in a compressor with a live preview. Our Compress Image tool lets you pick JPEG or WebP output and drag the quality slider while comparing before and after, all in your browser.
- 3.Judge at the size it will appear, not zoomed to 100%. Lower the quality until something starts to look wrong, then step back up a little. For many photos that lands somewhere between 40 and 60.
- 4.Check it on an actual Retina screen and on a standard monitor. A heavily compressed 2x image also looks fine on a 1x screen, because the browser shrinks it and averages the artifacts away.
Photos with lots of fine detail hide compression well. Flat illustrations, screenshots and text in images do not: blocky edges and color smears show up quickly. For those, keep a higher quality or use PNG or SVG.
Let the browser choose with srcset
If the image is a fixed size, such as an avatar or a logo shown at 200 pixels wide, list density versions with x descriptors:
<img src="avatar-200.webp"
srcset="avatar-200.webp 1x, avatar-400.webp 2x"
width="200" height="200" alt="Maria Lopez">If the image stretches with the layout, use width descriptors and a sizes attribute that tells the browser how wide the image will be at each breakpoint. The browser multiplies that width by the screen density and picks the smallest file that covers it.
<img src="hero-1200.webp"
srcset="hero-800.webp 800w, hero-1200.webp 1200w,
hero-1600.webp 1600w, hero-2400.webp 2400w"
sizes="(min-width: 1200px) 1100px, 100vw"
width="1100" height="620" alt="Team at work in the studio">- ●Always set
widthandheight. They give the browser the aspect ratio before the file arrives, so the page does not jump. - ●Add
loading="lazy"to images below the fold. Do not lazy load the main image at the top of the page, which hurts load time. - ●Generate the widths with Resize Image or your build tool, then compress each one. Frameworks such as Next.js and most image CDNs can produce the srcset for you.
Stop at 2x, even for 3x phones
A 3x file has more than twice the pixels of a 2x one, and at phone viewing distance the difference is very hard to see. Most sites are better off serving a well compressed 2x file to every high-density screen. With x descriptors, simply leave out the 3x entry. With width descriptors, the browser may still choose a larger file on a 3x phone, so cap your largest width at about twice the biggest slot the image fills.
Use SVG for logos, icons and diagrams
Vector graphics are drawn at whatever resolution the screen has, so one small SVG is sharp at 1x, 2x and 3x. Logos, icons, charts and simple illustrations should be SVG wherever the source allows. Run them through an SVG optimizer to strip editor metadata, and use a raster format only for photos and complex artwork.
CSS background images
For backgrounds, image-set() does what srcset does for img tags:
.banner {
background-image: image-set(
url("banner-1x.webp") 1x,
url("banner-2x.webp") 2x
);
}Put a plain background-image: url(...) line above it if you need to support very old browsers. Better still, if the background carries meaning, make it a real img element so it gets srcset, lazy loading and alt text.
Frequently asked questions
Should I name files @2x like iOS apps do?
Do 4K desktop monitors need 2x images too?
Is WebP or AVIF better for 2x images?
My image is sharp on my iPhone but soft on my Windows laptop. Why?
Sources & references
This article was researched and written by Nikola, drawing on the following primary sources and documentation:
Ready to try it?
All tools run entirely in your browser, no uploads, no account required.
Compress ImageMore in Performance & SEO
How to Fix "PDF Exceeds Maximum File Size Limit" on arXiv and Academic Portals
Why Do Animated GIFs Look Grainy? (And How to Convert to Smooth Animated WebP)
Best Image Format and Dimensions for Website Favicons and App Touch Icons (2026 Guide)

