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.
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 (and the resulting embedding probability) 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.
The two signals are combined into a plain-language verdict.
Tips and notes
- Use the original file. Re-saving as JPEG, screenshotting, or even some PNG re-encoders will wipe the LSBs and make detection impossible.
- A “clean” verdict is not a guarantee — payloads hidden in a small region, or with a non-sequential / encrypted scheme, can evade a whole-image statistic.
- A high score warrants deeper forensic tooling (bit-plane visualisation, dedicated extractors) to confirm and recover any payload.