---
title: "Tap code"
description: "A 5×5 grid tapped as row then column, C and K sharing a cell. Prisoners of war in Vietnam used it through the walls."
canonical_url: "https://ciphers.agntn.dev/ciphers/tap-code"
---
# Tap code

> A 5×5 grid tapped as row then column, C and K sharing a cell. Prisoners of war in Vietnam used it through the walls.

<cipher-facts name="tap-code">



</cipher-facts>

The Polybius grid again, but the letter dropped is K, sharing a cell with C. Each letter is a row count and a column count, both 1 to 5, digits separated by spaces. Anything that isn't a letter is dropped, spaces and punctuation included, and case doesn't matter.

```ts
const tap = create("tap-code");
tap.encode("HELP").text; // "2 3 1 5 3 1 3 5"
tap.encode("CK").text; // "1 3 1 3"
tap.decode("1 3").text; // "C"
tap.decode("2 3 1"); // throws, coordinate count must be even
```

Decoding checks that every coordinate is 1 to 5 and that they come in pairs, and the error names the position of the first bad one. Counting knocks by hand is easy enough to get wrong.


## Sitemap

See the full [sitemap](https://ciphers.agntn.dev/sitemap.md) for all pages.
