Skip to content

Porta Cipher

Type a message and a keyword to encode or decode it with the Della Porta cipher. Because every one of its 13 alphabets swaps the two halves of A–Z, the same steps encipher and decipher. The tool shows the full table and the sum behind each letter. Free, no sign-up, and nothing leaves your browser.

Mode

Letters only. The keyword repeats along the message, one key letter for each letter of text. A and B pick the same alphabet, so do C and D, and so on.

Porta is reciprocal: the same steps encode and decode, so Decode gives the same answer as Encode.

Keep in the result

Working

  • Letters are numbered A = 0, B = 1 … Z = 25, and every sum wraps around at 26.
  • Each alphabet swaps the two halves of the alphabet: a letter from A–M becomes a letter from N–Z, and the other way round. That is why the cipher is its own inverse.
  • Plain letter A–M (0–12): cipher letter = 13 + ((letter + pair) mod 13).
  • Plain letter N–Z (13–25): cipher letter = (letter − 13 − pair) mod 13.
  • The pair number is the key letter's number divided by two, rounded down: A and B give 0, C and D give 1 … Y and Z give 12.

Porta square — 13 alphabets

ABCDEFGHIJKLMNOPQRSTUVWXYZ
A,BNOPQRSTUVWXYZABCDEFGHIJKLM
C,DOPQRSTUVWXYZNMABCDEFGHIJKL
E,FPQRSTUVWXYZNOLMABCDEFGHIJK
G,HQRSTUVWXYZNOPKLMABCDEFGHIJ
I,JRSTUVWXYZNOPQJKLMABCDEFGHI
K,LSTUVWXYZNOPQRIJKLMABCDEFGH
M,NTUVWXYZNOPQRSHIJKLMABCDEFG
O,PUVWXYZNOPQRSTGHIJKLMABCDEF
Q,RVWXYZNOPQRSTUFGHIJKLMABCDE
S,TWXYZNOPQRSTUVEFGHIJKLMABCD
U,VXYZNOPQRSTUVWDEFGHIJKLMABC
W,XYZNOPQRSTUVWXCDEFGHIJKLMAB
Y,ZZNOPQRSTUVWXYBCDEFGHIJKLMA

Row = pair of key letters, column = plain letter, cell = cipher letter. Select a letter below to light it up: its row and column turn blue and the cell where they meet turns amber.

Plain letterKey letterAlphabetArithmeticCipher letter
PO,P12 + 7 = 19 ≡ 6 → 13 + 6 = 19T
OO,P4 + 7 = 11 → 13 + 11 = 24Y
RQ,R4 + 8 = 12 → 13 + 12 = 25Z
TS,T(19 − 13) − 9 = −3 ≡ 10K
AA,B12 + 0 = 12 → 13 + 12 = 25Z
PO,P4 + 7 = 11 → 13 + 11 = 24Y
OO,P0 + 7 = 7 → 13 + 7 = 20U
RQ,R(19 − 13) − 8 = −2 ≡ 11L
TS,T(19 − 13) − 9 = −3 ≡ 10K
AA,B7 + 0 = 7 → 13 + 7 = 20U
PO,P4 + 7 = 11 → 13 + 11 = 24Y
OO,P(14 − 13) − 7 = −6 ≡ 7H
RQ,R11 + 8 = 19 ≡ 6 → 13 + 6 = 19T
TS,T3 + 9 = 12 → 13 + 12 = 25Z
AA,B(18 − 13) − 0 = 5F
PO,P(19 − 13) − 7 = −1 ≡ 12M
OO,P(14 − 13) − 7 = −6 ≡ 7H
RQ,R(13 − 13) − 8 = −8 ≡ 5F
TS,T4 + 9 = 13 ≡ 0 → 13 + 0 = 13N
AA,B1 + 0 = 1 → 13 + 1 = 14O

Showing the first 20 letters.

How to Use the Porta Cipher Tool

  1. 1. Enter a keyword. Only its letters count. The keyword repeats along your message, one key letter for each letter of text, and A and B select the same alphabet, as do C and D.
  2. 2. Type or paste the message. Spaces, digits and punctuation pass through unchanged and do not use up key letters.
  3. 3. Encode or decode. Porta is reciprocal, so both settings give the same letters. Use whichever label matches what you are doing.
  4. 4. Read the working. Select any letter in the working table to light up its row, column and result in the 13-row table.

How the Porta Cipher Works

The Porta cipher is a polyalphabetic substitution cipher with only 13 alphabets, one for each pair of key letters: A,B then C,D and on to Y,Z. Number the letters A = 0 to Z = 25 and call the pair's number j (A and B give 0, C and D give 1, up to 12 for Y and Z). A plain letter in the first half of the alphabet, A–M, becomes 13 + ((p + j) mod 13), a letter from N–Z. A plain letter in the second half, N–Z, becomes (p − 13 − j) mod 13, a letter from A–M.

Every alphabet therefore swaps the two halves of the alphabet, and swapping twice puts each letter back. That is what makes Porta reciprocal: to decode, enter the cipher text and the same keyword and encode again. By hand you use one table of 13 rows, each row headed by its pair of key letters and listing the partners of A–M; the partners of N–Z are read upward.

Worked Example

Encode ATTACK AT DAWN with the keyword PORTA. The key letters are P = 15, O = 14, R = 17, T = 19 and A = 0, whose pairs are 7, 7, 8, 9 and 0.

PlainKeyAlphabetSumCipher
A (0)PO,P0 + 7 = 7 → 13 + 7 = 20U
T (19)OO,P(19 − 13) − 7 = −1 ≡ 12M
T (19)RQ,R(19 − 13) − 8 = −2 ≡ 11L
A (0)TS,T0 + 9 = 9 → 13 + 9 = 22W
C (2)AA,B2 + 0 = 2 → 13 + 2 = 15P

The full message becomes UMLWPR UL ZNCG. Run that through the tool again with PORTA and you get ATTACK AT DAWN back. Two other things to notice: both A's of ATTACK became different letters (U and W), so letter counting alone does not read the message, and no letter ever enciphers to itself, because every alphabet sends a letter to the opposite half of the alphabet.

Where the Porta Cipher Comes From

The cipher takes its name from Giovanni Battista della Porta, the Neapolitan scholar whose cryptography book De furtivis literarum notis appeared in 1563. It set out a keyed system of reciprocal alphabets and, in the same volume, the first known digraphic substitution cipher, which replaces pairs of letters at once. Porta's table was drawn for the shorter alphabet of his day; the 13-row, 26-letter table used here is the modern form published by the American Cryptogram Association, whose cipher descriptions the tool follows. The repeating-keyword idea was already in print in Italy: Giovan Battista Bellaso described it in 1553, a decade before Porta's book.

How the Porta Cipher Is Broken

Porta is a repeating-keyword cipher, so Friedrich Kasiski's 1863 method and William Friedman's index of coincidence, developed around 1920, find the key length just as they do for Vigenère. Once the length is known, every n-th letter was enciphered with one alphabet, so each column is a simple substitution that frequency analysis solves. Porta is easier than Vigenère in one respect: with 13 alphabets there are only 13 candidates for each column, not 26, and because each cipher letter lies in the opposite half of the alphabet from its plain letter, every column's cipher letters reveal which half of the alphabet each plain letter came from.

A puzzle cipher, not a secure one

Porta is a classroom and puzzle cipher. A computer breaks it from a few hundred letters, so never use it to protect anything private.

Frequently Asked Questions

What is the Porta cipher?
The Porta cipher is a polyalphabetic substitution cipher with 13 reciprocal alphabets, one for each pair of key letters. It is named after Giovanni Battista della Porta, who described reciprocal tables in his 1563 book on secret writing.
Is the Porta cipher reciprocal?
Yes. Each alphabet swaps the first half of the alphabet (A–M) with the second half (N–Z), so applying it twice returns the original letter. Encoding and decoding are the same operation with the same keyword, which is why this tool gives the same answer in both modes.
How do I decode a Porta cipher?
Enter the cipher text with the same keyword and apply the same steps. For each letter, find the row for its key letter's pair, then look up the partner of the letter in that row. The result is the plain letter.
Why do the key letters come in pairs?
There are 13 alphabets but 26 letters, so each alphabet is shared by two key letters: A and B, C and D, and so on up to Y and Z. This is why the keywords CAT and DAT produce identical cipher text under Porta.
How is Porta different from Vigenère?
Vigenère has 26 alphabets that shift the letters by the key, and it needs a separate decryption step. Porta has 13 alphabets that swap the two halves of the alphabet, so the same table encrypts and decrypts, and no letter can encrypt to itself.
Is the Porta cipher secure?
No. A repeating keyword leaves patterns that Kasiski examination and the index of coincidence reveal, and 13 alphabets leave even fewer possibilities per column than Vigenère. It is a historical cipher to learn from, not a way to keep secrets.

Related Tools

More in Codes & Ciphers

See all Codes & Ciphers