# PSNR and SSIM calculator: compare two images in your browser

> Load an original and a processed copy of the same size and get PSNR (RGB and luma), SSIM per Wang et al. 2004, and a heat map of where they differ. Runs in your browser; images are never uploaded. The formulas and the exact settings are on the page.

By PhotoAIBench. Updated 7 October 2026. Canonical URL: https://photoaibench.com/psnr-ssim-calculator/

> **Interactive tool.** The image comparison tool runs in the browser on the HTML version of this page: https://photoaibench.com/psnr-ssim-calculator/. Images are processed on your device and never uploaded. Load a reference image and a test image of the same size; it reports PSNR on RGB and on luma (BT.601), SSIM on luma (Wang et al. 2004: 11 × 11 Gaussian window, sigma 1.5, K1 0.01, K2 0.03, valid windows only), the share of identical pixels, and a heat map of the SSIM map or the absolute difference. Different sizes are refused with an explanation rather than resized.

## What the numbers mean

**PSNR** (peak signal-to-noise ratio) measures how far the pixel values are from the reference, on a logarithmic scale in decibels. Higher is closer; identical images have no error, so their PSNR is infinite.

```
MSE  = mean over every pixel (and every colour channel) of (reference − test)²
PSNR = 10 × log10(255² / MSE)      in dB, for 8-bit images
```

Every 6 dB means half the error amplitude (a quarter of the MSE). As a rough feel for 8-bit photos: above 40 dB differences are hard to see even side by side, 30 to 40 dB is typical of decent compression or a good 2x upscale, and below 25 dB the changes are obvious. Those bands are a feel, not a standard: the same PSNR can look very different depending on where the error is.

**SSIM** (structural similarity) compares small windows of the two images in three ways at once: average brightness, contrast, and structure (whether the pixel pattern goes up and down together). It runs from −1 to 1, and 1 means identical. For each 11 × 11 window:

```
SSIM(x, y) = ((2·μx·μy + C1) · (2·σxy + C2)) / ((μx² + μy² + C1) · (σx² + σy² + C2))
C1 = (0.01 × 255)²,  C2 = (0.03 × 255)²
```

μ are the window means, σ² the variances, σxy the covariance, all weighted by a Gaussian. The SSIM of the image is the average over every window.

**The heat map** shows where the differences are. The SSIM map paints each window by how dissimilar it is; the difference map paints each pixel by its largest channel difference. Amplify it to see small differences, which are often invisible at 1x.

## Exact settings, so you can reproduce the numbers

| Setting | Value |
|---|---|
| Colour values | As stored in the file, 8 bits per channel. EXIF orientation is applied; ICC colour profiles are not, and transparency is ignored. |
| PSNR (RGB) | MSE pooled over R, G and B of every pixel; peak 255 |
| PSNR (Y) and SSIM | On luma Y = 0.299 R + 0.587 G + 0.114 B (BT.601, full range, not rounded) |
| SSIM window | Gaussian, σ = 1.5, 11 × 11, weights normalised to sum to 1 |
| SSIM constants | K1 = 0.01, K2 = 0.03, L = 255; population (not sample) covariance |
| Image borders | Only windows that fit entirely inside the image are averaged; nothing is padded and no border is cropped |
| Downsampling | None |

These are the settings of Wang, Bovik, Sheikh and Simoncelli's 2004 paper and its reference code (`ssim_index.m`), and they match scikit-image's `structural_similarity` with `gaussian_weights=True, sigma=1.5, use_sample_covariance=False, data_range=255`. The tool's code is tested against scikit-image values to nine decimal places on every build.

Why your numbers may differ from another tool:

- **Some implementations downsample large images first.** The paper authors' later reference code (`ssim.m`) shrinks the image by about its smaller side divided by 256 before computing, and some libraries copied that. On a 12-megapixel photo that changes SSIM substantially. This tool never downsamples.
- **Super-resolution papers usually compute on a different Y.** They use studio-range luma (16 to 235) and crop a border as wide as the scale factor. Studio range squeezes values to 219/255 of the full range, which by itself raises PSNR by about 1.3 dB; the border crop usually raises it a little more.
- **Some tools average SSIM over R, G and B** instead of using luma, or use a uniform 7 × 7 or 8 × 8 window. Each choice moves the number.
- **Colour management.** If one program converts an image to sRGB from its embedded profile and another does not, the pixel values differ before any metric runs. This tool compares stored values.

## What PSNR and SSIM can and can't tell you

They are good at one question: **how close is this image to that one, pixel for pixel?** That makes them right for checking compression settings, for spotting an edit that changed more than intended, and for regression tests in an image pipeline.

They are bad at another question: **which of two images looks better?** The standard example is AI upscaling. A model trained to hit high PSNR learns to output the average of all the plausible answers, which is smooth and slightly blurry. A GAN-based upscaler invents sharp, plausible detail: fur, skin pores, foliage. Its detail is not in the right place pixel for pixel, so it scores lower PSNR and often lower SSIM, even when most people prefer it. Our [upscaler baselines](/upscaler-baselines/) show exactly this on real photos.

Other limits worth knowing:

- **A shift of one pixel ruins both metrics** while looking identical. Compare only images that are aligned.
- **They ignore where you look.** An error on a face counts the same as an error in a blurred background.
- **They can't detect invented content as such.** An upscaler that writes the wrong letters on a sign may lose only a little PSNR. Look at the heat map, then look at the image.
- **Perceptual metrics such as LPIPS** (a distance between deep-network features) agree with people more often on upscaling. We report LPIPS on the [baselines page](/upscaler-baselines/), computed in Python because it needs a neural network that is too large to ship in a web page.

## Privacy

Both images are decoded and compared by JavaScript on your device. The computation runs in a Web Worker so the page stays responsive. Nothing is sent to PhotoAIBench or anyone else; you can disconnect from the network after the page loads and the tool still works. Details are on the [privacy page](/privacy/).

## Limits of the tool

- Images up to 50 megapixels. A 12-megapixel pair takes a few seconds on a recent laptop.
- Both images must be exactly the same size. The tool refuses rather than resizing, because resizing would change the answer.
- Browsers that add noise to canvas reads to block fingerprinting (Brave's default, Firefox with `resistFingerprinting`) would corrupt the numbers. The tool checks for this when it loads and warns you if it finds it.
- HEIC opens only in Safari. Convert to PNG first in other browsers.
