Hiding rather than scrambling
The least significant bit (LSB) method
How can you hide a message in an image without the eye noticing? The most widespread technique exploits the way colours are encoded: the least significant bit method, or LSB.
How an image stores its colours
A digital image is a grid of pixels. Each pixel has three colour components: R (red), G (green) and B (blue). Each component is a byte, that is, a number encoded on 8 bits, from 0 to 255.
Within a byte, not all bits carry the same weight:
- the most significant bit (on the left) is worth 128;
- the least significant bit (on the right) is worth only 1.
bit de poids fort bit de poids faible
| |
v v
[ 1 1 0 0 1 0 1 ? ]
128 64 32 16 8 4 2 1
The key idea
Modifying the least significant bit of a component changes its value by only 1 out of 255 at most. For example, a red component with a value of 200 becomes 200 or 201: two shades of red impossible to tell apart with the naked eye.
You can therefore replace this last bit with a bit from the secret message, without the image appearing modified.
A concrete example
Let us hide the bits 1 0 1 in three successive components:
Composante Octet original bit secret Octet modifié
R 1100101|0 1 1100101|1 (202 -> 203)
V 0110110|1 0 0110110|0 (109 -> 108)
B 1010011|0 1 1010011|1 (166 -> 167)
The | mark separates the 7 most significant bits (unchanged) from the least significant bit (replaced). Each value moves by only 1.
Storage capacity
Each byte can hide only a single bit. It therefore takes 8 bytes to hide one character (encoded on 8 bits).
A colour image offers 3 bytes per pixel:
capacité (bits) = nombre de pixels x 3
capacité (octets)= nombre de pixels x 3 / 8
A small image of 1000 x 1000 pixels contains 1,000,000 pixels, i.e. 3,000,000 available bits, so around 375,000 hidden characters — the equivalent of a thick book, invisible to the eye.
An important limitation
The naive LSB method is fragile: if the image is recompressed (for example to JPEG), resized or edited, the least significant bits are modified and the message is destroyed. It works well with lossless formats (PNG, BMP).
In summary
- Each pixel has 3 components R, G, B, each encoded on a byte (8 bits).
- The least significant bit (LSB) is worth only 1: modifying it is imperceptible to the eye.
- You hide 1 bit of the message per byte in it.
- Capacity: around 3 bits per pixel, i.e. one byte for 8 components.
- Fragile against compression: reserve it for lossless formats.

