Tap Code Encoder / Decoder

Prison wall cipher used by Vietnam War POWs — 5×5 Polybius grid, audio tap playback.

12345
Plaintext
Tap Pattern (· = tap)
Enter text to encode as tap patterns.

How to Use the Tap Code Tool

  1. Choose Encode or Decode — select the direction with the option chips.
  2. Enter your message — type plaintext to encode, or tap patterns (use dots or numbers) to decode.
  3. Read the output — encoded messages show dot patterns; decoded output shows the original text.
  4. Audio playback — click the Audio chip then Play Taps to hear your message tapped out.

About the Tap Code

The Tap Code is a form of communication based on the Polybius square, used primarily by prisoners to communicate through walls. In the Tap Code, the letter K is omitted from the grid and C is used for K's sound, reducing the alphabet to 25 letters that fit in a 5×5 grid. Each letter is represented by two numbers — the row and column — which are communicated as groups of taps separated by pauses.

The Vietnam War POWs

The Tap Code became widely known through its use by American prisoners of war held at the Hanoi Hilton (Hoa Lo Prison) during the Vietnam War. Air Force pilot Smitty Harris learned the code from a retired officer who taught it as a historical curiosity. After being shot down in 1965, Harris taught the Tap Code to fellow prisoners. The code spread throughout the prison camp and became the primary means of covert communication between isolated prisoners. Using knuckles, cups, brooms, or even coughs, prisoners could transmit messages through walls, floors, and ceilings. Former Senator John McCain, who spent 5½ years as a POW, later described the Tap Code as crucial for maintaining morale and command structure.

The Tap Code Grid

The 5×5 grid arranges 25 letters (C used for K) in five rows and five columns. To tap a letter, you first tap the row number (pausing briefly between each tap), pause longer, then tap the column number. A long pause separates one letter from the next. For example: A = row 1, column 1 = •/• (one tap, pause, one tap). H = row 2, column 3 = ••/••• (two taps, pause, three taps). S = row 4, column 3 = ••••/••• (four taps, pause, three taps).

Encoding Tips

In practice, prisoners developed shorthand: certain common words or phrases were abbreviated to save time and reduce noise. "GN" for "good night," "GBU" for "God bless you," and "SHF" for "same here friend" were common. The letters were tapped in bursts — experienced tappers could communicate several words per minute. When guards were near, prisoners might use very subtle signals: scraping a broom, coughing in patterns, or tapping fingernails almost silently on a shared wall.

Audio Simulation

This tool uses the Web Audio API to generate realistic tap sounds for your message. Each tap is a brief click sound generated in your browser without any network request. The speed control adjusts the tempo from slow (learning mode) to fast (practiced tapper speed). Try encoding a short message and listening to the audio to get a sense of how information was transmitted through prison walls.

Frequently Asked Questions

The Tap Code is a cipher based on a 5x5 Polybius square where C and K share a cell. Letters are communicated by tapping row then column numbers through a wall. It became famous as the communication method used by American POWs at the Hanoi Hilton during the Vietnam War.
The 26-letter alphabet doesn't fit in a 5x5 grid. Tap Code removes K and uses C for its sound, so LIKE becomes LICE. Context makes the meaning clear to the reader.
Find the letter in the grid. Tap the row number first, pause briefly, then tap the column number. A longer pause separates one letter from the next. A = row 1, column 1 = one tap, pause, one tap.
Tap Code was used by American POWs in the Hanoi Hilton during the Vietnam War (1960s–1970s). It was taught by Smitty Harris and allowed prisoners to communicate despite strict isolation, maintaining morale and command structure.
Morse code uses dots and dashes (two symbols) with variable-length sequences. Tap Code uses only taps with pauses to encode fixed two-number coordinates. Tap Code is simpler to learn and produce with just a knuckle on a wall but slower than Morse.