Skip to content
A CRT terminal on a checkered table, dithered with Bayer 4×4 in 1-bitThe same terminal before dithering

10Ordered

Bayer 4×4 Dithering

Bayer 4×4 is the classic ordered dither: a 4×4 threshold matrix, from Bryce Bayer’s 1973 method, tiled across the image. It renders 17 gray levels as a regular cross-hatch, the texture of early computer graphics and retro games, and it’s fast, predictable and perfectly stable in animation.

Author
Bryce Bayer
Year
1973
Complexity
low

How Bayer 4×4 dithering works

The 4×4 matrix holds the ranks 0 to 15, built by nesting the 2×2 pattern inside itself. Each pixel is compared with the threshold at its position in the tile: brighter pixels turn white, darker ones black. Nothing is carried between pixels.

Because each level lights the pixel farthest from those already lit, every gray is spread as evenly as the grid allows, which produces the characteristic cross-hatch. Sixteen thresholds give 17 levels: enough for gradients that look smooth from a distance, few enough that the pattern stays part of the look.

Threshold ranks
08210
124146
31119
157135
  • A 4×4 matrix of 16 ranks is tiled across the image; a pixel turns white when its brightness exceeds the threshold at its position.
  • That gives 17 distinct gray levels, each reproduced by a fixed dot pattern.
Pseudocode
M = 4×4 matrix of ranks 0…15
for each pixel (x, y):
  t = (M[y mod 4][x mod 4] + 0.5) / 16 * 255
  pixel = gray < t ? black : white
# with a palette, t shifts the color before nearest_color

When to use it (and when not to)

  • Best for: retro game and demoscene looks, UI graphics and animated GIFs.
  • Works well with: small palettes like Game Boy, PICO-8 or NES.
  • Watch out for: the grid is visible on photos, and it can beat into moiré when the result is resized by a fraction instead of a whole multiple.
  • In animation: Very stable. Each pixel’s threshold depends only on its position, so areas that don’t move stay identical from frame to frame, with no shimmer. The animated sample on the home page uses Bayer 4×4 with PICO-8.

Bayer 4×4 vs other algorithms

The same terminal in 1-bit, center crop at actual size.

Bayer 4×4 compared with Bayer 2×2, Bayer 8×8, Blue Noise
AlgorithmMethodAnimationLook
Bayer 4×44×4 threshold matrixStableClassic cross-hatch, stable
Bayer 2×22×2 threshold matrixStableChunkier, 5 levels
Bayer 8×88×8 threshold matrixStableFiner, 65 levels
Blue Noise64×64 threshold matrixStableNo grid, fine grain, also stable

Try Bayer 4×4 on your image

Open the editor with Bayer 4×4 already selected, drop in a photo or an animated GIF, choose the processing scale for the dot size, pick a palette and export the result. Free, no account, no watermark, and your image never leaves your device.

Open Bayer 4×4 in the editor

Bayer 4×4 FAQ

Why is Bayer dithering used for games and GIFs?

It’s cheap, every pixel can be computed independently, and the pattern is fixed to the pixel grid, so moving sprites and animated frames don’t shimmer. The regular texture also compresses well.

Why does my dithered image show moiré when resized?

The pattern repeats every 4 pixels, so scaling by a fraction makes it beat against the new pixel grid. PixelSynth enlarges the view and the export nearest-neighbor by whole multiples, which keeps it crisp; resize by whole multiples elsewhere too.