W3docs

Tools

Image Diff

Compare two images and see exactly which pixels changed. Set a threshold, read the percent changed, and switch between pixel difference, side by side, swipe and onion skin. Images are compared in your browser — nothing is uploaded.

Images are compared in your browser. Nothing is uploaded.

Image A (original)

Drop image A here

or paste it (Ctrl/⌘ + V)

Image B (changed)

Drop image B here

or paste it (Ctrl/⌘ + V)

0–255. A pixel counts as changed when any channel (R, G, B or alpha) differs by more than this.

Add two images (or load the sample pair) to see what changed.

About this image diff tool

This tool compares two images pixel by pixel and shows you exactly what changed. Drop, paste or pick an original image (A) and a changed one (B): the page reports how many pixels differ, what percentage of the image that is, and the box that holds every change. Four views help you see the difference: pixel difference (changed pixels in red over a faded copy of A), side by side, a swipe slider with a draggable divider, and onion skin, which cross-fades from A to B.

A pixel counts as changed when any of its four channels (red, green, blue or alpha) differs by more than the threshold. The threshold runs from 0 to 255: at 0 every difference counts, and raising it ignores faint changes such as JPEG noise or anti-aliasing. Values are compared raw, without premultiplying by alpha, so a colour change under a transparent pixel is still caught. When the images are different sizes the tool says so, pins both to the top-left corner, and counts the area covered by only one image as changed.

Everything happens in your browser. PNG files are decoded by the page itself so the exact stored values are compared; other formats (JPEG, WebP, GIF, SVG) are decoded by the browser. Large images are processed in small slices so the page stays responsive, and nothing is uploaded: you can disconnect from the network after the page loads and the tool keeps working. Use it for visual regression checks, reviewing a redesigned screenshot, or confirming that an optimised image really is identical to the original.

Worked example

An 8x8 white image (A) and the same image with a 4x4 black square in the top-left corner (B), compared at threshold 0.

What the tool reportstext
Changed:         25%
Changed pixels:  16 of 64
Canvas:          8x8
Changed area:    x 0–3, y 0–3 (4x4 box)

Every pixel in the square differs by 255 in R, G and B, so it is changed at any threshold below 255.

The same rule in JavaScriptjs
// a and b are ImageData objects of the same size (from a canvas).
function countChanged(a, b, threshold = 0) {
  let changed = 0
  for (let i = 0; i < a.data.length; i += 4) {
    const delta = Math.max(
      Math.abs(a.data[i] - b.data[i]),         // red
      Math.abs(a.data[i + 1] - b.data[i + 1]), // green
      Math.abs(a.data[i + 2] - b.data[i + 2]), // blue
      Math.abs(a.data[i + 3] - b.data[i + 3]), // alpha
    )
    if (delta > threshold) changed++
  }
  return changed
}

Reading pixels back from a canvas premultiplies alpha, so semi-transparent colours lose precision; this tool decodes PNGs itself to avoid that.

A threshold that ignores faint changestext
A: every pixel rgb(100, 100, 100)
B: every pixel rgb(110, 110, 110)

threshold 0  → 100% changed (delta 10 > 0)
threshold 10 → 0% changed   (delta 10 is not > 10)

A delta equal to the threshold does not count; the change has to be strictly larger.

Frequently asked questions

Are my images uploaded to a server?

No. The images are read, decoded and compared in your browser tab. No image data is sent anywhere, and the difference PNG you download is generated locally too.

What does the threshold do?

It sets how big a difference must be before a pixel counts as changed. A pixel is changed when its largest channel difference (red, green, blue or alpha, each 0–255) is greater than the threshold, so 0 catches every difference and higher values ignore faint noise.

Can I compare images of different sizes?

Yes. The tool shows both sizes, aligns the images at the top-left corner on a canvas as large as the bigger width and height, and counts the pixels that only one image covers as changed. It does not scale or auto-align the images.

Why does a JPEG show changes when the pictures look the same?

JPEG compression changes pixel values slightly each time an image is saved, so two visually identical JPEGs rarely match exactly. Raise the threshold to around 10–30 to ignore that noise and keep real edits.

Which file formats can I compare?

Any image your browser can open: PNG, JPEG, GIF, WebP, BMP, SVG and usually AVIF. PNGs are compared with their exact stored values, including colour under transparent pixels. PDF files are not supported.

What is in the downloaded difference image?

A PNG the size of the comparison canvas where changed pixels are red and all other pixels are white, at the current threshold. It is handy for attaching to a bug report or a visual regression review.