ForHosting KIT · Developer Utilities

Bifid cipher

With the keyword SECRET, HELLO becomes HKNFO in the Bifid cipher: Félix Delastelle's keyed 5×5 Polybius square splits each letter into row and column digits and mixes them across the message. The same keyword decrypts it. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
HELLO
Key
SECRET
Calculation mode
Encrypt
You get
Result
HKNFO
Length
5
Letters mapped
5
Square
5x5

The Bifid cipher, invented by Félix Delastelle, combines a keyed five-by-five Polybius square with a fractionation step that splits each letter into row and column coordinates, then reads those coordinates by rows and columns before pairing them again into ciphertext. Unlike a plain Polybius square that merely emits digit pairs, Bifid mixes coordinates across the message so the ciphertext alphabet stays letters while diffusion improves over simple substitution. You paste plain text or ciphertext, supply a keyword that shapes the square, choose encrypt or decrypt, and receive a deterministic uppercase result with letter counts and the filled alphabet for verification. Non-letters are skipped so only A–Z participate; J shares I’s cell on the classical twenty-five-cell grid.

How Bifid fractionation works with a keyed Polybius square

Bifid starts by building a five-by-five Polybius square from your keyword. Unique Latin letters from the key are written first in order of appearance, with every J rewritten as I so twenty-six letters fit twenty-five cells; the remaining letters of the alphabet fill the rest of the grid in natural order without a second J. Each plaintext letter is then located on that square and recorded as a pair of coordinates: a row digit from one to five and a column digit from one to five.

Encryption does not emit those pairs directly. Instead it writes all row digits in one long line and all column digits in a second line, concatenates the two lines into a single stream of twice the letter count, and re-groups that stream into successive row-column pairs that are looked up on the same square to produce ciphertext letters.

That re-pairing is the fractionation step: each ciphertext letter depends on coordinates from different plaintext positions, so frequency patterns of simple substitution are broken while the output remains alphabetic and easy to write by hand. Decryption reverses the process: each ciphertext letter expands to two coordinates, the first half of the doubled stream becomes the row line and the second half the column line, and pairing the i-th row with the i-th column recovers each plaintext letter.

Where Bifid cipher tools show up in real work

Introductory cryptography and history-of-ciphers courses assign Bifid drills so students practice Polybius coordinates and then see how fractionation changes the ciphertext compared with a plain square; a single trusted oracle that encrypts and decrypts with a keyed five-by-five grid speeds homework demos and auto-graders. Capture-the-flag challenges and puzzle hunts still hide Bifid messages behind a short keyword, and solvers want a fast, predictable Delastelle implementation rather than a general cryptanalysis suite.

Support and content teams sometimes lightly encode spoilers, quiz answers, or internal labels with a shared keyword and need the reverse path without installing a language-specific crypto library. If you need a plain Polybius digit-pair map without fractionation, a Caesar letter shift, Autokey or Beaufort keyword ciphers, or automatic frequency-analysis recovery of unknown keys, treat those as separate search intents and landings rather than overloading this classical Bifid page.

Classroom Bifid and fractionation demos

Encrypt and decrypt sample words with a shared keyword so intro-crypto lessons show Polybius coordinates and fractionation on one ground-truth oracle.

Puzzle and CTF Bifid challenges

Encode or reverse Delastelle Bifid ciphertexts for challenge strings without writing a one-off script for every problem set.

What is the Bifid cipher?

A classical cipher by Félix Delastelle that uses a keyed 5×5 Polybius square and fractionates row/column coordinates before re-pairing them into ciphertext letters. This tool implements that textbook process with I and J sharing one cell.

Why is the key required?

The keyword builds the Polybius square (unique key letters first, then the rest of the alphabet).

How do I decrypt a Bifid ciphertext?

Set mode to decrypt, paste the ciphertext letters, and use the same keyword that encrypted them. Only Latin letters are used; non-letters are skipped.

How is Bifid different from a Polybius square?

Plain Polybius maps each letter to a digit pair. Bifid still uses a Polybius square but splits and recombines coordinates across the message so the output stays letters and simple frequency patterns are disrupted.

What does it cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/enc/bifid

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/enc/bifid \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"HELLO","key":"SECRET"}'
{
  "text": "HELLO",
  "key": "SECRET"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "enc.bifid",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

An empty key or a key with no Latin letters fails immediately with invalid_input, because the square cannot be built without at least one alphabetic character.

How Bifid fractionation works with a keyed Polybius square

There is no random pad, no date stamp, and no network call—identical text, key, and mode always yield identical JSON. This landing implements classical period-unbounded Bifid on a keyed I/J square only, not period-N blocks, not Trifid, and not automatic cryptanalysis of unknown keys.

What you send and what you get back

Send a required string field named text, a required string field named key, and an optional mode field set to encrypt or decrypt. Classic checks include encrypting HELLO with key SECRET to a stable ciphertext, decrypting that ciphertext with the same key back to HELLO, mapping J through the same cell as I, and confirming that an empty key is rejected rather than inventing a default square. When mode is omitted, encrypt is the default so a minimal payload still produces ciphertext. The key must contain at least one Latin letter after reading A–Z and a–z; an empty string, whitespace-only key, or key made only of digits and punctuation fails with invalid_input and a message that names the empty-key rule. On success the response echoes mode, text, and key, returns result as the uppercase transformed letter string, length of that result, letters_mapped as how many Latin letters participated, plus square, ij_combined, alphabet as the twenty-five-character row-major fill used for the run, and cipher set to bifid for clients that assert the profile they hit. Missing text, missing key, non-string objects for those fields, unsupported mode values, strings longer than the documented maximum, and decrypt payloads with no letters all fail with invalid_input and a clear English message. Validation failures do not consume prepaid balance. Pricing for successful API calls is the published base of $0.002 per item.

Where Bifid cipher tools show up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Lightweight keyword-based label encoding

Turn quiz answers or internal labels into Bifid letter streams and decode them later with the same key in browser or API.

Read the full KIT documentation →