T

Text Machine

Powerful text tools, in your browser

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

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.

Text
Result

Enter text above to see the Porta result here.

How to use Porta Cipher

  1. 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. 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. 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. 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?
The Porta cipher, or Della Porta cipher, is a polyalphabetic substitution cipher published by the Italian scholar Giovan Battista della Porta in 1563. Like the Vigenère cipher it shifts each letter by a repeating keyword, but it uses a table of just 13 reciprocal alphabets that swap the two halves of the alphabet, which makes it reciprocal: the same operation both encrypts and decrypts.
How does the Porta cipher work?
Number the alphabet from A as 0 to Z as 25 and repeat the keyword across the message. Each key letter selects one of 13 alphabets, paired so that A or B picks the first, C or D the next, and so on. Within an alphabet the first half A–M swaps with the second half N–Z. Only letters are changed; spaces, digits, and punctuation pass through and do not advance the keyword.
Is the Porta cipher the same as the Vigenère cipher?
They are relatives but not the same. Vigenère adds the key to the plaintext, C = (P + K) mod 26, and uses a different step to decrypt. Porta instead splits the alphabet in half and swaps the halves using 13 paired alphabets, which makes it reciprocal so one step does both directions. A message enciphered with one will not decrypt correctly under the other.
Why is the Porta cipher reciprocal?
Every Porta alphabet pairs the first half of the letters, A–M, with the second half, N–Z, so each letter maps to a partner that maps straight back. Encryption sends a letter into the opposite half, and running the result through the same row sends it home, while the rotation set by the key pair cancels. Applying the cipher twice therefore returns the message, so one operation both encrypts and decrypts.
Can you show a Porta cipher example?
Encrypting HELLO with the keyword KEY gives ZTXQM. The key letters K, E, Y, K, E select their paired alphabets, and in each one the message letter swaps to H→Z, E→T, L→X, L→Q, O→M. Decrypting ZTXQM with the same keyword KEY and the same procedure returns HELLO, because the table is its own inverse.
How do I decode a Porta cipher?
Use the same keyword that was used to encrypt, and paste the ciphertext into the tool. Because Porta is reciprocal there is no separate decode mode: entering the keyword and the ciphertext produces the original plaintext directly. If you do not know the keyword, you must recover it by cryptanalysis.
Why does the Porta cipher have only 13 alphabets?
Porta groups the 26 key letters into 13 pairs, and each pair shares one alphabet: A or B selects the first, C or D the second, and so on up to Y or Z. Each alphabet swaps the first half of the letters with the second half, which is what makes the cipher reciprocal. The trade-off is that two different key letters can behave identically, which slightly reduces the keyword's strength.
What keyword should I use?
Any word or phrase of letters works. A longer, less predictable keyword is stronger, because the security of the cipher depends on the keyword being long, hard to guess, and never reused. Short or common keywords are quickly broken. Spaces, digits, and punctuation in the keyword are ignored, so only its letters matter.
Does the Porta cipher change spaces and punctuation?
No. Only the 26 letters are enciphered. Spaces, digits, and punctuation pass through unchanged, and they do not consume a keyword letter, so the keyword stays aligned with the letters it transforms. Letter case is preserved in the output so the result keeps the shape of your original text.
How do you break the Porta cipher?
Porta is a repeating-key cipher, so the attack resembles the one that breaks Vigenère. First find the key length using the Kasiski examination and the index of coincidence, then split the ciphertext into columns that share one alphabet. Because key letters are paired, each column has only 13 possible alphabets, so an analyst can try all 13 and pick the one that reads as language.
Is the Porta cipher secure?
No. By modern standards it provides no real security: a repeating keyword falls to classical cryptanalysis, and even long keywords cannot withstand a computer. It is best treated as an educational and puzzle cipher and a piece of cryptographic history. For genuine protection, use a modern algorithm such as AES instead.
Is my text uploaded to a server?
No. All encoding and decoding happen entirely in your browser, so your text and keyword are never uploaded, logged, or stored. Even a share link keeps your data in the part of the URL after the hash, which browsers never send to a server, so it stays private until you choose to share it.

Related tools

Keep going with these handy tools

Beaufort Cipher

Gronsfeld Cipher

Trithemius Cipher

Vigenère Cipher

Autokey Cipher

Running Key Cipher