ForHosting KIT · Developer Utilities

Trifid cipher

With the keyword KEYWORD and period 5, DEFENDTHEEAST encrypts to ERKQJAYHKOBQL. Each letter becomes three cube coordinates that are then regrouped, mixing substitution with transposition. Use the same keyword and period to decrypt. 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
DEFENDTHEEAST
Key
KEYWORD
Period
5
Calculation mode
Encrypt
You get
Result
ERKQJAYHKOBQL
Cube
KEYWORDABCFGHIJLMNPQSTUVXZ.
Length
13
Symbols processed
13

The trifid cipher is Félix Delastelle’s classical fractionating system that maps each of twenty-seven symbols—letters A through Z plus a period—onto three coordinates inside a keyed 3×3×3 cube, then rewrites those coordinates in groups whose length is the period. Reading the coordinate matrix by rows and regrouping triplets yields ciphertext that mixes substitution with transposition-style diffusion, a step beyond monoalphabetic maps such as affine or Atbash. Students, CTF players, puzzle authors, and curriculum tools use trifid to practice cube construction, period fractionation, and round-trip decrypt with a shared keyword. This capability accepts non-empty text, a cube keyword, a period of at least two, and an optional encrypt or decrypt mode; it returns the transformed string, the expanded cube, and processing counts.

How the trifid cube and period fractionation work

Build the cube by taking unique A–Z and period characters from your keyword in order, then appending every remaining alphabet symbol so the string always has exactly twenty-seven positions. Index zero through eight form layer zero, nine through seventeen form layer one, and eighteen through twenty-six form layer two; within each layer a three-by-three grid supplies row and column, each coordinate in zero, one, or two.

Encryption converts every plaintext symbol to its three coordinates, writes them as three rows under a period-sized group, reads left to right across all layers then all rows then all columns, and maps every consecutive triplet back to a cube symbol. The last group may be shorter than the period when the message length is not a multiple of period; that shorter block is fractionated the same way with its own width.

Decryption expands each ciphertext symbol to three digits, splits the stream into three equal rows of length equal to the group size, and rebuilds each plaintext symbol from the stacked layer, row, and column at that index.

Validation rules, alphabet filtering, and common pitfalls

After uppercasing letters, only A–Z and the period character remain; spaces, digits, commas, and other punctuation are stripped so period groups stay well-defined. The key must be a non-empty string that still contains at least one alphabet symbol after the same filter; empty or punctuation-only keys are rejected. Period must be an integer between two and two hundred fifty-six inclusive: a period of one, zero, or any negative value fails with a clear message that a period below two is invalid for trifid fractionation.

Mode accepts encrypt, encode, decrypt, or decode; unknown mode strings fail validation. Round-trip only works when encrypt and decrypt share the same keyword and period; changing either rebuilds a different cube or different group widths and will not recover the original message. Do not treat trifid as modern encryption for confidentiality: the alphabet is tiny, the construction is public, and frequency structure still leaks under analysis.

Prefer this landing when the search intent is trifid cipher, Delastelle trifid, or 27-symbol cube cipher; bifid, Playfair, affine, rail fence, and XOR answer different classical intents and stay separate tools.

Trifid in class and its practical limits

Call the free in-browser trifid cipher for homework checks, lecture slides, CTF practice, and one-off encrypt or decrypt runs without hand-coding a 3×3×3 table in every language. Puzzle sites can precompute answers offline and reveal them with mode decrypt. Support playbooks can reverse lightly obfuscated notes written with known classroom keys.

Authors shipping SDKs can map the result field into a copy button while cube, period, and method make OpenAPI examples self-explanatory. Pair with other classical ciphers only when a later teaching step needs a different family—keep trifid on its own landing so SEO intent stays sharp around keyed cube fractionation.

Cryptanalysis homework and CTF warm-ups

Students encrypt short phrases with a keyword and period, then decrypt classmates’ ciphertexts or recover messages under known-cube constraints without installing extra crypto libraries.

How do I decrypt trifid ciphertext?

Send the ciphertext as text, the same key and period used to encrypt, and mode decrypt (or decode). The result is the reconstructed plaintext when parameters match.

What happens if period is below two?

Trifid fractionation requires a period of at least two symbols per group; period 1 or less is rejected and not charged.

Is the trifid cipher tool free?

The browser tool runs free on your device.

Is the trifid cipher secure encryption?

No. Trifid is a classical fractionating cipher for puzzles and teaching, not confidentiality. Never use it for passwords or sensitive data.

How is the cube built from the keyword?

The unique letters of the keyword come first, in order, followed by every remaining letter and the period sign, for exactly 27 positions. KEYWORD gives KEYWORDABCFGHIJLMNPQSTUVXZ. and those positions fill three layers of nine.

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/trifid

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/trifid \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"DEFENDTHEEAST","key":"KEYWORD","period":5}'
{
  "text": "DEFENDTHEEAST",
  "key": "KEYWORD",
  "period": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "enc.trifid",
  "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.

A period below two fails with invalid_input because fractionation needs groups of two or more symbols.

How the trifid cube and period fractionation work

Send JSON with required string text, required string key, required integer period at least two, and optional mode defaulting to encrypt; aliases input, value, s, and message work for the body, keyword, cube_key, and alphabet_key alias key, while p, group, and step alias period. On success the response includes result, mode normalized to encrypt or decrypt, key as filtered keyword symbols, period, cube with the full twenty-seven-character table, length and symbols_processed for the filtered message, alphabet listing the canonical twenty-seven symbols, and method equal to trifid. Identical inputs always produce identical JSON because the path is pure table walks with no network, no random seed, and no wall clock.

Validation rules, alphabet filtering, and common pitfalls

Missing text, non-string text, or an empty string all raise invalid_input and are not charged on the prepaid API after the engine rejects the request. If nothing alphabet remains, the request fails with invalid_input.

API usage, pricing, classroom workflows, and practical limits

Use the prepaid KIT API when a backend, serverless function, tutoring platform, or SDK needs a stable contract under balance at $0.002 per successful item; validation failures never consume balance after rejection. A typical classroom workflow shows how a keyword seeds the cube, encrypts a short motto with period five, then decrypts with the same parameters to prove invertibility, and finally demonstrates that period one is rejected as invalid_input. Keep payloads to ordinary message sizes appropriate for a Worker isolate item call; this tool is for phrases and teaching snippets, not multi-megabyte binary blobs.

Classroom Delastelle demos

Teachers show 3×3×3 cube construction, period fractionation versus monoalphabetic maps, and pin period-below-two failures as a clear invalid_input fixture.

Pipeline and CI fixtures

Scripts and continuous-integration tests pin deterministic trifid outputs and the period validation error so accidental reshape or cube-order bugs fail fast.

How do I encrypt text with the trifid cipher?

Send JSON with non-empty text, a keyword for the cube, integer period at least 2 (for example 5), and optional mode encrypt (the default). The response result field holds the ciphertext.

Read the full KIT documentation →