Porta Cipher
Encode and decode the Della Porta cipher, a keyword-based polyalphabetic cipher published by the Italian scholar Giovan Battista della Porta in 1563. It is reciprocal: the same keyword both encrypts and decrypts, so there is no separate decode mode. Enter a keyword and watch the 13 paired alphabets work live. Everything runs in your browser.
Porta is reciprocal: the same keyword both encrypts and decrypts. To decode a message, paste the ciphertext and enter the same keyword, and the result is the original plaintext. There is no separate decode button.
Keyword
The keyword is the secret shared by sender and receiver. It repeats across the message, and each of its letters selects one of the 13 reciprocal alphabets. Because the alphabets are paired, A and B pick the same one, C and D the next, and so on. Only letters are used; any spaces, digits, or punctuation in the keyword are ignored.
Enter text above to see the Porta result here.
How to use Porta Cipher
- 1
Enter the keyword
Type the shared secret keyword, such as CIPHER. Only its letters are used; any spaces, digits, or punctuation are ignored. The same keyword is used for both encrypting and decrypting.
- 2
Type or paste your text
Enter the message you want to convert: plaintext to encrypt, or Porta ciphertext to decrypt. The cipher runs automatically as you type, and the letter-by-letter working updates live below.
- 3
Read the reciprocal result
Because Porta is reciprocal, the same keyword serves both directions. To recover a message, paste the ciphertext and enter the same keyword that was used to encrypt it; the result is the original plaintext.
- 4
View, copy, and share
Open the working to see which key pair and alphabet enciphered each letter, then copy the result, download it as a text file, or share a link that reopens the tool with your exact keyword and text.
Understanding the Porta Cipher
What is the Porta cipher?
The Porta cipher, more fully the Della Porta cipher, is a polyalphabetic substitution cipher described by the Italian polymath Giovan Battista della Porta in his 1563 book De Furtivis Literarum Notis. Like the Vigenère cipher it uses a repeating keyword so that the same plaintext letter can encrypt to many different ciphertext letters depending on its position, which flattens the letter-frequency patterns that betray a simple substitution. It is one of the earliest practical polyalphabetic systems, and for centuries it was admired for being both reasonably strong and easy to use by hand.
What sets Porta apart is its table of just 13 reciprocal alphabets rather than the 26 shifted rows of a full Vigenère square. Each alphabet is built so that the first half of the alphabet always exchanges with the second half, which gives the cipher its most useful property: it is reciprocal, meaning the very same operation both encrypts and decrypts. Della Porta is often remembered as one of the founders of modern cryptography, and this neat self-inverse table is the idea most associated with his name.
How the Porta cipher works
Number the alphabet from A as 0 to Z as 25. The keyword is repeated as many times as needed to line up one key letter under every letter of the message. Each key letter chooses one of 13 rows, and the rows come in pairs: A or B selects the first row, C or D the second, E or F the third, and so on up to Y or Z, which selects the thirteenth. Calling that pair number r, which runs from 0 for A or B up to 12 for Y or Z, a plaintext letter in the first half of the alphabet (A–M, values 0–12) enciphers to C = 13 + ((P + r) mod 13), landing somewhere in the second half N–Z. A letter in the second half maps back into the first half with C = (P − 13 − r) mod 13.
On paper this is done with the Porta table, a grid of 13 rows. To encipher a letter you find the row for the current key letter, locate the plaintext letter in that row, and read off its partner. Letters are the only characters transformed; spaces, digits, and punctuation pass straight through and do not consume a key letter, so the keyword stays lined up with the letters that matter. The live working below the tool shows exactly this for each letter of your message, including which key pair selected the alphabet.
Worked example
Encrypt the message HELLO with the keyword KEY. Repeating the keyword gives the key letters K, E, Y, K, E lined up under H, E, L, L, O. The key letter K belongs to the K or L pair, so it selects that row, and in it H enciphers to Z. The key letter E belongs to the E or F pair, and in that row E enciphers to T. The key letter Y, from the Y or Z pair, turns L into X. K again turns the next L into Q, and E turns O into M. The ciphertext is ZTXQM.
Now decrypt ZTXQM with the same keyword KEY and the same procedure. In the K or L row, Z maps back to H; in the E or F row, T maps back to E; in the Y or Z row, X maps back to L; K returns Q to L; and E returns M to O. The result is HELLO again. The identical operation recovered the message, which is the whole point of the Porta cipher.
Why Porta is its own inverse
The reciprocal property is built into the shape of every row. Each alphabet pairs the first half of the letters, A–M, with the second half, N–Z, so that whatever A–M letter maps to a given N–Z letter, that N–Z letter maps straight back. Encryption sends a first-half letter into the second half, and feeding the result back through the same row sends it home again. The rotation set by the key pair cancels for exactly the same reason, so encrypting twice returns you to where you started.
This is genuinely convenient. With Vigenère you must add when encrypting and subtract when decrypting, so the two directions use different procedures. With Porta there is only one procedure to learn, and a single table or a single tool serves both directions. That is why this tool has no separate decode button: you simply enter the same keyword and paste whichever text you want to convert.
Porta, Vigenère, and Beaufort
It helps to line up the related keyword ciphers. The Vigenère cipher adds the key to the plaintext, C = (P + K) mod 26, and needs the reverse subtraction to decrypt. The Beaufort cipher subtracts the plaintext from the key, C = (K − P) mod 26, and is reciprocal. The Porta cipher reaches reciprocity a different way: instead of shifting the whole alphabet it splits it in half and swaps the halves, using only 13 paired alphabets keyed by letter pairs. All of them share a repeating keyword and a printed table, which is why they are easy to confuse.
Because the geometry differs, a message enciphered with one of these ciphers will look like gibberish under another. This tool implements the classic reciprocal Della Porta table. If you need the adding rule, the Vigenère tool on Text Machine covers Vigenère and its related modes, and the Beaufort tool covers the other reciprocal keyword cipher.
How to break the Porta cipher
Porta inherits the strengths and weaknesses of any repeating-key polyalphabetic cipher. Its defence is that one plaintext letter maps to several different ciphertext letters, which flattens the obvious letter-frequency peaks that give a simple substitution away. Its weakness is that the key repeats. Once an analyst guesses the length of the keyword, the ciphertext splits into separate columns that were each enciphered with a single fixed alphabet, and each column becomes a simple reciprocal substitution that yields to frequency analysis.
The classic way to find the key length is the Kasiski examination, which looks for repeated groups of letters and measures the distances between them, together with the index of coincidence, which measures how uneven the letter frequencies are. Porta is in one sense weaker than Vigenère: because key letters come in pairs, each column has only 13 possible alphabets rather than 26, so once the key length is known an analyst can simply try all 13 for each column. A Porta message is therefore only as strong as its keyword is long, unpredictable, and used just once.
Is the Porta cipher secure?
No. By modern standards the Porta cipher offers no real security. A short or repeated keyword falls quickly to the Kasiski and index-of-coincidence methods above, and even a long keyword cannot withstand a determined analyst with a computer. It belongs to the era of hand ciphers, where its appeal was a clever, easy-to-use reciprocal table rather than unbreakable strength.
Today the Porta cipher is valued for learning and for fun. It is an excellent way to understand polyalphabetic substitution and the elegant idea of a self-inverse cipher, and it appears often in puzzles, escape rooms, and capture-the-flag challenges. For protecting real information you should rely on modern, well-tested algorithms such as AES instead.
Frequently asked questions
What is the Porta cipher?
How does the Porta cipher work?
Is the Porta cipher the same as the Vigenère cipher?
Why is the Porta cipher reciprocal?
Can you show a Porta cipher example?
How do I decode a Porta cipher?
Why does the Porta cipher have only 13 alphabets?
What keyword should I use?
Does the Porta cipher change spaces and punctuation?
How do you break the Porta cipher?
Is the Porta cipher secure?
Is my text uploaded to a server?
Related tools
Keep going with these handy tools