CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Code / How Computers Store Everything

Hide a Message in a Picture

Lesson 11 of 11 · 7 min · Free, no account needed

What you will learn

  • Steganography hides that a message exists at all, not just what it says.
  • The least significant bit (the last bit) of a colour number changes it by only 1: invisible.
  • 8 pixels' last bits make one byte, so 8 pixels hide one letter.
  • Lossy saving, like JPEG, changes last bits and breaks the secret.

Start the lesson

How the lesson goes

  1. Two photos look exactly the same. One carries a secret message. Which one?

    Tap your bet.

  2. How much can a colour change before you notice?

    Add a little to the red of one pixel, then a lot.

  3. Look at only the last bit of every red number.

    Use the lens on both pictures.

  4. Steganography.

    Steganography: hiding a message so nobody even knows it is there. Encryption hides the meaning; this hides the message.

    The least significant bit is the last bit of a number. Flipping it changes red by just 1 out of 255.

    One letter is one byte, 8 bits, so 8 pixels hide one letter.

  5. How a computer reads a hidden letter.

    Step through 8 pixels.

  6. Hide the first letter of your own secret word.

    Type a word, then tap pixels until their last bits spell its first letter.

  7. Hide the rest of your word.

    Each next letter goes into the next 8 pixels. Drag the letter bytes onto the strips, in order.

  8. Spot the secret: 5 pairs, only 3 lenses.

    Pick the picture with the secret in each pair. A saved lens is worth 10 points.

  9. AI image makers can hide a 32 bit watermark that says "made by AI".

    If each pixel hides 3 bits, one in the last bit of red, green and blue, how many pixels are needed?

  10. A friend sent you a picture. Read the hidden word.

    Tap each pixel to write down its last bit.

  11. Which changes to a pixel would anyone see?

    Colours go from 0 to 255.

  12. Your friend opens your picture. One letter comes out wrong.

    Find the pixel that broke and fix it.

Previous lesson: Secret Messages · Part of the course: How Computers Store Everything

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab