Cheat sheet, tested
What resolution should a photo be for the web?

Short answer
Does a web photo need 72 or 300 DPI? Neither. Changing that number altered 4 bytes of a 2048 pixel JPEG and not one pixel, and Chromium showed both versions at the same size. What counts is the width in pixels. Take the width the photo fills on the page, in CSS pixels, and multiply it by the screen's pixel ratio. A photo across a 390 px phone screen at ratio 3 needs about 1170 px; a 720 px article column at ratio 2 needs 1440 px. Wider files add bytes, not detail. Instagram sizes anything wider than 1080 px down to 1080.
Key takeaways
- The DPI number does nothing on screen: 72 and 300 DPI versions had identical pixels, and 4 of 639,886 bytes differed. It only sets the print size.
- Pixels needed = width of the space on the page × the device pixel ratio. That is 1170 px for a full-width phone photo and 1440 px for a 720 px article column on a ratio 2 laptop.
- Files narrower than the slot lost detail (similarity 0.70 to 0.91). Files at or above it scored 0.989 to 1.000, so the 6000 px original added nothing a 1440 px slot could show.
- For a 1440 px slot, raising JPEG quality beat going wider: 1440 px at quality 95 was 538 KB and 2880 px at quality 82 was 1,126 KB, with about the same similarity.
- The free Koldflux resizer turned the 19.4 MB photo into a 1080 × 1440 px Instagram portrait of 507 KB in 1.8 seconds, without uploading it.
How many pixels wide should a web photo be?
Find the place where your photo will appear and read across. The CSS width is the space on the page as the browser measures it; the pixel ratio is how many screen pixels sit in each of those. If your page is narrower, scale the number down in proportion.
| Where the photo shows | CSS width | Pixel ratio | Export this wide |
|---|---|---|---|
| Full width on a phone | 390 px | 3 | 1170 px |
| Article column on a laptop | 720 px | 2 | 1440 px |
| Full width on a 1440 px desktop monitor | 1440 px | 1 | 1440 px |
| Wide hero on a laptop | 1080 px | 2 | 2160 px |
| Instagram feed photo | set by Instagram | n/a | 1080 px (its published maximum) |
| Print, 4 × 6 in at 300 DPI | n/a | n/a | 1200 × 1800 px |
| Print, 8 × 10 in at 300 DPI | n/a | n/a | 2400 × 3000 px |
Pixels = CSS width × pixel ratio.
Your own pixel ratio is easy to see: open the browser console on the device and type window.devicePixelRatio. MDN describes that value as the ratio of the resolution in physical pixels to the resolution in CSS pixels. The table uses 3 for the phone and 2 for the laptop as examples; check yours, because a higher ratio means a small photo needs more pixels than its size on screen suggests.
For print, the maths runs the other way: pixels = inches × DPI. The test photo, 6000 × 3663 px, prints at 20 × 12.2 in at 300 DPI. That is the only place where the DPI number does real work.
Does the 72 or 300 DPI setting change anything on screen?
No, and you can stop worrying about it. The test took one JPEG, 2048 × 1250 px, and saved two copies that differ only in the density field of the file header: one says 72 DPI, the other 300 DPI.
The two files have the same size, 639,886 bytes, and only 4 bytes differ, the ones that hold the number. Decoded, their pixels have the same checksum. Placed on a page with no width set, Chromium drew both at 2048 CSS pixels. Saving the DPI a second way, in the EXIF block through the sharp library, gave the same result: identical pixels.
The number only matters when the photo goes to paper. At 300 DPI those 2048 pixels make a print 6.83 in wide; at 72 DPI the same pixels would be spread across 28.44 in. Nothing about the photo changes, only the instruction to the printer.
There is one narrow exception in the HTML standard. If a file stores its resolution in EXIF together with matching pixel dimension tags, the browser lays it out at a size worked out with 72 as the base, so a file marked 144 DPI with those tags would appear at half its pixel width. Files without the matching tags, like the two test files, are shown at their pixel width.
Why is a wider file not sharper?
Because the screen can only show as many pixels as it has. The test resized the photo to six widths, from 640 to 6000 px, then scaled each one to the slot it would fill and compared it with the original scaled the same way. A score of 1 means identical; this is a similarity score (SSIM), not a judgment of how it looks to you.
The pattern held in all three slots. A file narrower than the slot had to be stretched and lost detail: 0.857 for a 1080 px file on a 1170 px phone slot, and 0.910 for a 2048 px file in a 2160 px slot, even though it was only 5% short. A file at or above the slot scored 0.989 or higher, whether it was 1440 or 6000 px wide.
So the 6000 px original, 19.4 MB, brings nothing a phone or a laptop article can display. Exporting at the slot width is enough; exporting a little wider covers screens with a higher pixel ratio.

Should you spend bytes on JPEG quality or on width?
Width is only half the file size story. JPEG compression also blurs fine detail, and that showed up clearly: a 1440 px JPEG at quality 82 scored 0.950 in its own 1440 px slot, while the same width saved without compression scored 1.000.
You could fix that by exporting wider, because shrinking a bigger JPEG hides some of its compression marks. Raising the quality at the slot width did the same job for fewer bytes.
| File width | Quality 70 | Quality 82 | Quality 90 | Quality 95 |
|---|---|---|---|---|
| 1440 px | 204 KB, 0.929 | 280 KB, 0.950 | 385 KB, 0.968 | 538 KB, 0.981 |
| 2048 px | 423 KB, 0.961 | 580 KB, 0.969 | 793 KB, 0.976 | 1,106 KB, 0.980 |
| 2880 px | 832 KB, 0.974 | 1,126 KB, 0.978 | 1,548 KB, 0.981 | 2,171 KB, 0.984 |
One photo, one encoder (sharp JPEG), from the 6000 px original. Another photo or encoder will give other numbers.
Read across a row and down a column: 1440 px at quality 90 matched 2048 px at quality 82 for 34% fewer bytes, and 1440 px at quality 95 matched 2880 px at quality 82 for 52% fewer. Even quality 95 at the slot width is under 3% of the 19.4 MB original.
If your site builds several sizes for you, a srcset list does the width part automatically: the browser chooses among the files you offer, taking the slot width from sizes and the device pixel ratio into account. So sizes must describe the real width of the slot on your page, and the list needs a small candidate for narrow slots. MDN's responsive images guide covers the syntax; the snippet below is the shape of it.
<img src="harbour-1440.jpg"
srcset="harbour-640.jpg 640w, harbour-1170.jpg 1170w, harbour-1440.jpg 1440w, harbour-2160.jpg 2160w"
sizes="(max-width: 760px) 100vw, 720px"
width="1440" height="879" alt="Bourtzi castle and harbour">
How do you resize a photo for Instagram in your browser?
Instagram Help states that photos up to 1080 px wide keep the best quality, wider ones are sized down to 1080 px, and ratios from 1.91:1 to 3:4 are kept without cropping. So for the feed, 1080 px wide is the whole answer. 1080 × 1350 (4:5) works, and 1080 × 1440 (3:4) is the tallest frame Instagram keeps uncropped.
- Open the Instagram portrait post resizer and choose your photo. It stays on your device; nothing is uploaded.
- Wait for the file name to appear as a button, for example bourtzi-1080x1440.jpg.
- Press it to download. You get exactly 1080 × 1440 px, centre-cropped to 3:4.
On the test photo it took 1.8 seconds and turned 19,425,906 bytes into 507,162. The framing matched a centre crop made separately with the sharp library (similarity 0.991 when both were compared at a small size). The output carries no DPI value at all, which, as the first test showed, makes no difference on a screen.
A wide landscape loses its sides in a 3:4 portrait. If the subject sits off centre, crop it yourself first, or use the 1080 × 1080 square post resizer, which keeps more of the width.

How we checked, and what this does not show
The photo is "Bourtzi castle harbour Karystos Euboea Greece" by Jebulon on Wikimedia Commons, CC0, 6000 × 3663 px, saved at 240 DPI; its SHA-1 is in the log. All resizing used sharp with libvips JPEG shrink-on-load turned off and the lanczos3 filter; similarity is the ffmpeg SSIM filter. Controls: each reference scored 1.000 against a second copy of itself, and a 1440 px file shown at 1440 CSS px in Chromium matched its decoded pixels at 1.000.
One design was changed during the test, and the log keeps both. The first version compared Chromium screenshots, but Chromium's own downscaling of the 6000 px reference differed from the resized files enough to swamp the result. A JPEG-only sweep at quality 82 also mixed width with compression, so width and quality were then tested separately.
What this does not show: one landscape photo full of fine water texture, one encoder (sharp, the libvips JPEG encoder) and one similarity measure. Faces, text, flat graphics, PNG and WebP may need different numbers. Nothing was uploaded to Instagram, so what Instagram does after upload comes from its Help page, not from our test.
Do it in your browser
Free Koldflux tools, no account needed.
Shrink a photo for your website (free, in your browser)Social media image sizesInstagram portrait post resizer (1080 × 1440)
Questions people ask
Is 72 DPI the right resolution for a website?
The DPI number does not matter on a website. A 72 DPI and a 300 DPI copy of the same JPEG had identical pixels and showed at the same size. Choose the width in pixels instead.
Will a 300 DPI photo look sharper online?
No. Only the pixel width and the compression change what you see. Resaving at 300 DPI changed 4 bytes in the test file and left every pixel as it was.
What size should a website image be?
The width it fills on the page in CSS pixels times the screen pixel ratio: about 1440 px for a 720 px article column on a ratio 2 laptop, 2160 px for a 1080 px wide hero.
What resolution should I use for Instagram?
1080 px wide. Instagram Help says wider photos are sized down to 1080 px. Use 1080 × 1350 or 1080 × 1440 for a portrait post.
What resolution do I need to print a 4 × 6 photo?
At 300 DPI, 1200 × 1800 px. Multiply each side in inches by the DPI; an 8 × 10 in print needs 2400 × 3000 px.
Related
More guides on this topic
Sources and how we checked
- Koldflux Instagram portrait post resizer (our own tool, run November 20, 2026) (checked 2026-11-20)
- Koldflux test log: DPI tag, width sweep, quality grid, resizer run and controls (our measurement, November 20, 2026) (checked 2026-11-20)
- How to rerun every test (Koldflux, shell script) (checked 2026-11-20)
- The test code: sharp, ffmpeg SSIM and Playwright (Koldflux, Node.js) (checked 2026-11-20)
- Instagram Help: Image resolution of photos you share (checked 2026-10-05)
- MDN: Window.devicePixelRatio (checked 2026-11-20)
- MDN: Responsive images (srcset and sizes) (checked 2026-11-20)
- W3C: CSS Values and Units Level 4, absolute lengths (1px = 1/96th of 1in) (checked 2026-11-20)
- WHATWG HTML: images, density-corrected natural width and height (checked 2026-11-20)
- Wikimedia Commons: Bourtzi castle harbour Karystos Euboea Greece, by Jebulon, CC0 (test photo) (checked 2026-11-20)
We used one CC0 photo from Wikimedia Commons (Bourtzi castle and harbour, Karystos, by Jebulon), 6000 × 3663 px, 19,425,906 bytes, 240 DPI, on November 20, 2026, on Ubuntu with Node.js 24, sharp (libvips) with shrink-on-load off and the lanczos3 filter, ffmpeg 6.1.1 and Playwright Chromium. Test 1: one 2048 px JPEG at quality 85 saved twice with a JFIF density of 72 and 300, compared byte by byte, by decoded pixel MD5 and by layout width in Chromium; the EXIF density route through sharp was checked the same way. Test 2: the photo resized to 640, 1080, 1440, 2048, 3000 and 6000 px, each scaled to slots of 1170, 1440 and 2160 device pixels and scored with SSIM against the original scaled the same way, first as JPEG quality 82, then without compression (PNG) to isolate width; pass mark 0.99, set before the runs. Test 3: widths 1440, 2048 and 2880 at JPEG quality 70, 82, 90 and 95, scored in the 1440 px slot. Test 4: the Koldflux Instagram portrait post resizer on koldflux.com in headless Chromium, output read back and checked for size, bytes, density and framing against a sharp centre crop. Controls: every reference scored 1.000 against a second copy; a 1440 px file shown at 1440 CSS px matched its decoded pixels at 1.000. Instagram facts are from Instagram Help as recorded on our resizer page (read October 5, 2026), not tested by upload. Instagram is a trademark of Meta; Koldflux is not affiliated with or endorsed by it.