0Pricing
Cryptology Academy · Lesson

Image Steganography: LSB Technique

Understand Least Significant Bit (LSB) steganography and how secret data is embedded in image pixels.

Image Steganography: LSB Technique is a free Cryptology Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Pixels as RGB Triplets

A digital colour image is made up of pixels. Each pixel stores three colour channel values: Red, Green, and Blue, each ranging from 0 to 255 and stored in one byte. A 1000x1000 pixel image therefore contains three million individual bytes of colour data. This large volume of data creates room for hiding small amounts of additional information without visible change.

The Least Significant Bit

In an 8-bit value, the least significant bit contributes only 1 to the value when set, compared to 128 for the most significant bit. Flipping the LSB of a colour channel changes a pixel value by at most 1 out of 255, a change completely imperceptible to the human eye. This makes the LSB the ideal location for embedding hidden bits without degrading visible image quality.

Storing One Byte Across Eight Pixels

To hide one byte (8 bits) of secret data, we overwrite the LSB of eight consecutive pixels in a single colour channel. Reading those LSBs back in order reconstructs the original hidden byte. This is the simplest LSB steganography algorithm. The modification to the image is so subtle that pixel pairs like (200, 201) look identical visually while the LSB difference carries meaningful data.

Payload Capacity Calculation

A 24-bit colour BMP image with 1 million pixels has 3 million bytes of pixel data and 3 million individual colour channel values. Using one LSB per channel, we can hide 3 million bits or 375 kilobytes of data. With a carrier file of 10 megapixels, roughly 3.75 megabytes can be hidden. This is sufficient for thousands of text documents or small executables.

Visual Imperceptibility

The human visual system is much more sensitive to colour hue and saturation than to tiny brightness differences of 1 unit. An image with every LSB replaced by secret data is visually indistinguishable from the original when viewed on a normal display. The perceptual quality metric PSNR (Peak Signal-to-Noise Ratio) for LSB steganography is typically above 50 dB, well above the threshold of human perception.

Sequential vs Random LSB Placement

The simplest approach embeds bits in pixels sequentially from the top-left corner. This is easy to implement and detect: steganalysts know exactly where to look. A more secure approach uses a pseudorandom number generator seeded with a shared key to select which pixels and which colour channels receive hidden bits. An analyst without the key cannot determine where the payload is embedded.

PRNG-Based Pixel Selection

By seeding a PRNG with a secret key, sender and receiver can independently generate the same pseudo-random sequence of pixel coordinates. The sender embeds bits only at those coordinates; the receiver extracts bits from the same coordinates in the same order. An attacker who does not know the key faces a combinatorial search problem even if they know steganography was used.

Steganography Tools in Practice

OpenStego and Steghide are popular open-source tools that implement LSB steganography with optional password-based encryption. Steghide supports JPEG, BMP, WAV, and AU formats and applies a passphrase to both select embedding locations and encrypt the payload. Using a passphrase ensures that even if the presence of hidden data is detected, recovering the content requires the passphrase.

JPEG vs BMP for Steganography

BMP files store raw uncompressed pixel data, making LSB embedding straightforward and lossless. JPEG uses lossy compression that discards high-frequency detail and slightly alters pixel values. LSB embedded in a JPEG before saving will be destroyed by recompression. Steganography in JPEG must work in the frequency domain (DCT coefficients) rather than pixel values, which is more complex but widely used.

Capacity vs Detectability Trade-off

Embedding more data increases payload capacity but also increases statistical distortion. Using two bits per channel doubles capacity but makes the statistical signature stronger. Tools like StegExpose can detect common LSB tools by analysing pixel pair distributions. The safe payload is generally kept below 10 to 15 percent of carrier capacity to avoid triggering detection algorithms.

LSB Steganalysis: Pixel Pair Analysis

Pixel Pair Analysis exploits a predictable artefact of LSB embedding. Natural images have a characteristic distribution of pixel value pairs; LSB embedding slightly disturbs this by changing odd values to even or vice versa. By measuring the ratio of close-value pixel pairs, steganalysts can estimate both whether embedding occurred and approximately how much data was hidden.

LSB Capacity

A 24-bit colour BMP image with 1,000,000 pixels uses one LSB per colour channel. How much data can be hidden?

LSB Steganography: Key Takeaways

LSB steganography embeds secret bits in the least significant bits of pixel colour channels, causing imperceptible visual change. One byte of hidden data requires eight pixels. A 1-megapixel image can hide about 375KB using one LSB per channel. PRNG-based pixel selection with a shared key improves security. JPEG requires DCT-domain embedding. Statistical analysis via pixel pair distributions can detect LSB embedding.

Frequently asked questions

Is the “Image Steganography: LSB Technique” lesson free?

Yes — the full text of “Image Steganography: LSB Technique” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Image Steganography: LSB Technique”?

Understand Least Significant Bit (LSB) steganography and how secret data is embedded in image pixels. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Image Steganography: LSB Technique” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Steganography vs Cryptography
  2. Image Steganography: LSB Technique
  3. Audio and Document Steganography
  4. Steganalysis: Detecting Hidden Messages
← Back to Cryptology Academy