A1Z26 Cipher Encoder and Decoder

Decode
Encode
const text = "Hello World";

const ciphered = [...text.toLowerCase()]
  .map((c) => {
    if (c >= "a" && c <= "z") {
      return c.charCodeAt(0) - "a".charCodeAt(0) + 1;
    } else {
      return "";
    }
  })
  .filter(Boolean)
  .join(" ");

console.log(`A1Z26 cipher of ${text}: ${ciphered}`);

The A1Z26 cipher

The A1Z26 cipher is a very simple substitution cipher in which each character in the original text is replaced by its one-based index in a given alphabet. The "key" for this cipher is the delimiter—it separates the numbers for decoding. A becomes 1 and Z becomes 26, giving this cipher its name.

Example

Take the following sentence:

The quick brown fox jumps over the lazy dog.

Using the A1Z26 cipher results in the following ciphertext:

20 8 5 17 21 9 3 11 2 18 15 23 14 6 15 24 10 21 13 16 19 15 22 5 18 20 8 5 12 1 26 25 4 15 7

Note that the neither the spaces or period is included in the ciphertext. This is because it is they are not present in the alphabet. This means that its decoding will not include these characters.

thequickbrownfoxjumpsoverthelazydog