← All resources

Should you normalize RGB values by 255 or 256?

Auto-discovered

Blog Intermediate

Pekka Väänänen

Visit resource ↗

Description

Should you normalize RGB values by 255 or 256? is Pekka Väänänen's technical essay on 30fps.net comparing two common recipes for converting eight-bit RGB channels to floating point. The article asks whether dividing by 255 or using a half-step bias with division by 256 better matches how displays and encoders quantize intensities.

Väänänen walks through mid-riser versus mid-tread quantization models, round-trip errors when encoding and decoding, and how dithering interacts with each scaling choice. A later section revisits Chris Lomont's mixed encode/decode formulas that some image-processing pipelines adopt for symmetry.

Readers should understand linear versus gamma-encoded color at an intermediate level and be comfortable reading small numerical examples. Shader and texture tooling authors benefit most when picking constants for sRGB upload paths.

The essay is a free static page on 30fps.net with updated notes as Väänänen refines recommendations. It is not tied to a particular engine API, though examples speak to GPU texture upload conventions.

Väänänen's 30fps.net graphics writing is frequently linked in demoscene and engine programmer communities; this 255-versus-256 thread appears in forum debates whenever teams audit color pipeline correctness.