Tap Code Encoder/Decoder

Prisoner knock cipher — encode letters as row and column taps on a 5×5 grid.

Free tap code (knock code) encoder and decoder. Maps each letter to two groups of taps giving its row and column on a 5×5 Polybius grid (C and K share a cell), and decodes tap groups back to text. The cipher famously used by prisoners of war. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the tap code?

The tap code, or knock code, is a way to send letters by tapping. It arranges 25 letters in a 5×5 grid and represents each letter by tapping its row number, a short pause, then its column number. It was famously used by American prisoners of war in Vietnam to communicate between cells.

The tap code (also called the knock code) is a simple way to transmit text by tapping — on a wall, a pipe or any surface. It became famous when American prisoners of war used it in Vietnamese prisons to communicate silently between cells. Each letter is sent as two groups of taps: the first group gives a row and the second gives a column on a 5×5 grid of letters.

How it works

The 25 cells of a 5×5 Polybius square are filled with the alphabet, omitting K (senders use C in its place):

    1  2  3  4  5
 1  A  B  C  D  E
 2  F  G  H  I  J
 3  L  M  N  O  P
 4  Q  R  S  T  U
 5  V  W  X  Y  Z

To encode a letter, find it in the grid and send its row number as that many taps, pause, then its column number as that many taps. For example, R is in row 4, column 2, so it is ···· ·· — four taps, a pause, two taps. Decoding reverses this: read each pair of numbers as (row, column) and look up the letter.

Worked example

The word WATER encodes letter by letter: W = row 5, col 2; A = row 1, col 1; T = row 4, col 4; E = row 1, col 5; R = row 4, col 2. As tap groups that is 52 11 44 15 42. This tool renders each group with dot characters and gaps so you can read the rhythm, and the decoder turns either dots or plain numbers back into WATER.

Notes and tips

Remember the grid skips K — type C where you mean K, and read it from context on the way out. Tap code carries no secret key, so it is for covert signalling rather than secrecy; anyone who knows the grid can read it. Letters are case-insensitive and non-letters are ignored on encode. The decoder accepts both dot groups and plain digit pairs like 4 2. Everything runs locally in your browser.