Camera, Mic & Media
Image Steganography - Hide Text in an Image
Hide a secret text message inside any PNG image using LSB steganography, or reveal hidden messages from an image. All processing runs locally in your browser.
How LSB steganography works
The message is converted to UTF-8 bytes, then to individual bits. Each bit is written into the
least significant bit (LSB) of the red channel of successive pixels. A null byte (\x00) marks the end of the message. Because the change is only ±1 per pixel, the image looks
identical to the human eye.
Important: use PNG only
JPEG compression averages nearby pixels together, which destroys the single-bit changes. Always use PNG (lossless) as both input and output to preserve the hidden message.
Privacy
All encoding and decoding runs on an HTML5 canvas in your browser. No images or text are sent to any server.
Steganography vs. cryptography
These two security techniques serve different goals and are often combined:
- Cryptography makes the content of a message unreadable to anyone without the key. An observer can see that an encrypted message exists but cannot read it.
- Steganography hides the existence of the message itself. A stego image looks like an ordinary photo - an observer has no reason to suspect a hidden message.
For strong privacy, combine both: encrypt your plaintext message first (e.g., with AES), then embed the ciphertext in the image. An attacker who discovers the steganography still cannot read the message without the encryption key.
Detection (steganalysis)
Steganography is not undetectable by determined analysis:
- Visual comparison: comparing the original and stego images side-by-side at high zoom or adjusting brightness/contrast can reveal subtle pixel changes.
- Statistical analysis (chi-square test): LSB steganography changes the statistical distribution of least-significant bits in a predictable way. A chi-square test on pixel values can detect when LSBs have been replaced with message data.
- Histogram analysis: the pixel value histogram of a stego image shows characteristic "pairs" where adjacent values are equalized, which is detectable.
Capacity limits
Using 1 LSB per color channel per pixel (3 channels), a PNG image can store:
Capacity (bytes) = width × height × 3 / 8
A 1000 × 1000 pixel image can hold: 1000 × 1000 × 3 / 8 = 375,000 bytes ≈ 366 KB of hidden data. Larger messages require proportionally larger carrier images. Hiding very large messages in small images increases detectable artifact density.