Floyd-Steinberg Dithering
Reduce a picture to black and white, a few greys or a small colour palette, and spread each pixel’s rounding error onto its neighbours so the average tone survives.
How to Use
- Drop an image on the box, click to browse, or paste one. TIFF, PSD, HEIC, TGA and camera RAW files open too. A built-in sample is loaded so you can try the presets straight away.
- Choose a Palette: 1-bit black and white, 4 or 8 greys, 4-shade green, or 8, 27, 64 or 216 colours.
- Leave Method on Floyd-Steinberg, or pick None to see the same palette with plain rounding. Tick Serpentine to scan alternate rows right to left.
- Click the picture to follow one pixel: Show Work gives its value, the error it received, the level it rounded to and how its own error was shared out.
- Save from the Save panel at the size you will use. Resizing a dithered picture afterwards blurs or breaks the dot pattern.
Worked Example
A flat mid-grey (128) dithered to black and white. The first pixel rounds to 255, because 128 ÷ 255 = 0.502, leaving an error of 128 − 255 = −127. Its right-hand neighbour receives 7/16 of that, −55.56, so it holds 72.44 and rounds to 0, passing on +72.44. The next holds 128 + 31.69 = 159.69 and rounds to 255. Row after row the pixels settle into a checkerboard, and on a 64 × 64 patch 50.1% of them are white.
A quarter grey (64). Now the first row stays black: the error builds up, 64 → 92 → 104.25 → 109.61 → 111.95, but never passes the halfway point of 127.5. The error pushed downwards makes every second row alternate black and white, and over a 64 × 64 patch 24.9% of the pixels are white, one in four, as the tone requires.
The common mistake: resizing after dithering. The dot pattern only works pixel for pixel. Shrinking a dithered picture to half size averages each 2 × 2 block back into grey, and enlarging it with smoothing blurs the dots. Resize first, then dither at the size the picture will be printed or shown.
Show Work
Formulas
below 5/16 · below-right 1/16
Floyd and Steinberg, 1976
Robert W. Floyd and Louis Steinberg published the algorithm in 1976 as “An adaptive algorithm for spatial grey scale”, in the Proceedings of the Society for Information Display, volume 17, pages 75–77. The four weights, 7/16, 3/16, 5/16 and 1/16, were found by trial and error, guided by the wish that an area of 50% grey should come out as a checkerboard, which is exactly what the first worked example shows.
The method belongs to a family called error diffusion: instead of throwing a pixel’s rounding error away, it is handed on to pixels not yet processed, so the error never piles up anywhere. Because only pixels to the right and below receive error, the whole picture can be done in one pass. It is still widely used, for example when a full-colour picture is saved as a GIF with only 256 colours.
About This Tool
This tool dithers to eight fixed palettes with Floyd-Steinberg error diffusion, can scan in serpentine order, shows plain rounding for comparison, reports the colours used and the mean brightness before and after, and works through any pixel you click, including the error it received and passed on. Settings can be put in the page address, for example ?palette=gray4&serp=1.
Images are decoded and saved in your browser by the engine behind the Universal Image Converter, so TIFF, PSD, HEIC, TGA and RAW files work too. Nothing is uploaded.
Related tools: Posterize (Color Levels), Pixel Art Editor, and Universal Image Converter.
Frequently Asked Questions
How does Floyd-Steinberg dithering work?
Pixels are visited row by row. Each one is rounded to the nearest palette level, and the difference (the error) is shared among neighbours not yet visited: 7/16 to the right, 3/16 below-left, 5/16 below and 1/16 below-right. Dark and light pixels then mix so the average over any small area stays close to the original tone.
Why does a 50% grey look lighter once dithered to black and white?
The dithering is done on the stored sRGB values, so 128 becomes half black and half white pixels. Half the pixels at full white send out half the light, and half the light corresponds to about 188 in sRGB, not 128, because sRGB values are gamma-encoded. Nearly all dithering tools work this way; it mostly shows in mid-greys.
What does Serpentine do?
It scans every other row from right to left and mirrors the 7/16, 3/16, 5/16, 1/16 pattern to match, so the error does not always travel the same way. That breaks up the diagonal streaks a one-way scan can leave in smooth areas such as skies.
Where does the 4-shade green palette come from?
It imitates the green-tinted screens of early handheld game consoles. The picture is dithered to 4 even grey levels (0, 85, 170 and 255) and each level is then shown as one of four greens, #0f380f, #306230, #8bac0f and #9bbc0f, so the dot pattern is the same as the 4-grey palette.
Does the tool pick the best palette for my picture?
No. Every palette here is fixed and evenly spaced: greys at equal steps, or 2, 3, 4 or 6 levels for each of red, green and blue (6 levels are the 216 web-safe colours). Fixed palettes give the same result for every picture, which suits print, screens with few greys, and retro graphics.
How do I use the Floyd-Steinberg Dithering?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Does it cost anything or need an account?
No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.
Is anything I type uploaded?
No. The tool works entirely on your device, so the values you enter never leave your browser.
Common Use Cases
Thermal and laser printers
A 1-bit black-and-white version prints cleanly on receipt and label printers that can only place black dots.
E-ink and small displays
4 or 8 grey levels match many e-paper and monochrome screens, with dithering standing in for the missing tones.
Retro and pixel-art graphics
The 4-shade green palette and the 8-colour palette give the look of early consoles and home computers.
Small-palette web images
The 216-colour web-safe palette keeps gradients smooth where plain rounding would leave hard bands.
Last updated: