Estimate whether an image hides data
LSB (least-significant-bit) steganography hides a message by overwriting the lowest bit of each colour value — a change invisible to the eye. This tool loads a lossless image (PNG or BMP), reads every pixel via the Canvas API, and applies statistical steganalysis to estimate whether such data is present. It reports a likelihood; it does not extract the payload, because that requires knowing the exact embedding scheme, ordering, and any encryption key.
How it works
The image is drawn to an off-screen <canvas> and its raw RGBA bytes are read with getImageData. Two complementary tests run over the R, G and B channels:
-
Chi-squared (Pairs of Values) test. For every pair of adjacent values that differ only in the last bit —
(0,1), (2,3), … (254,255)— the test compares the observed counts against the average of the pair. In a clean image these pairs are usually unequal; sequential LSB embedding pushes each pair toward equality. A large chi-squared statistic signals likely hidden data. -
LSB-balance check. It counts how many least-significant bits are
1versus0. Natural images are rarely exactly 50/50; a ratio extremely close to 0.5 across millions of pixels is a hallmark of an embedded bitstream, because a random message bit-stream is naturally balanced.
The two signals are combined into a plain-language verdict.
Why LSB steganography works — and why it is detectable
The human visual system cannot distinguish a pixel value of 200 from a pixel value of 201. The colour difference is smaller than the noise introduced by JPEG compression, lighting variation, or camera sensor noise. This is why encoding one bit of a hidden message in the last bit of each channel produces an image that is visually indistinguishable from the original.
However, natural photographic images are not random. Adjacent pixel values tend to cluster — they follow the texture and colour of real surfaces. The statistical distribution of value pairs like (200, 201) in a real photo is usually quite unequal. Sequential LSB embedding overwrites each channel’s lowest bit with a bit from the hidden message, which is approximately random. That randomness flattens the pair counts toward equality — and that is what the chi-squared test detects.
Limitations and false positives
| Scenario | Effect on detection |
|---|---|
| Re-saved as JPEG or PNG with re-encoding | LSBs are destroyed; detection fails |
| Dithered or synthetic image | Naturally random LSBs may trigger false positive |
| Payload in only a small region | Whole-image statistic may score low despite real embedding |
| Non-sequential or encrypted LSB scheme | May distribute bits in patterns that evade this test |
| Palette-mode PNG | Colour-indexed images need different analysis |
Tips for forensic use
- Use the original file as downloaded or received — any conversion, screenshot, or re-save can wipe or corrupt the LSBs.
- A high score warrants deeper investigation with dedicated forensic tools that visualise individual bit planes and attempt extraction with known schemes (for example, OpenStego, StegSolve, or Aletheia).
- A “clean” verdict means sequential LSB embedding is unlikely to be present across the whole image — it does not rule out non-standard or partial embedding techniques.
Your image is processed entirely in your browser via the Canvas API. Nothing is uploaded.