Caesar cipher
With a shift of 3, “Hello, World!” becomes “Khoor, Zruog!”: every Latin letter moves three places and the alphabet wraps from Z back to A, while spaces and punctuation stay in place. The same key decrypts it. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hello, World!
- Integer letter shift
- 3
- Calculation mode
- Encrypt
- Result
- Khoor, Zruog!
- Shift mod 26
- 3
- Length
- 13
- Letters shifted
- 10
The Caesar cipher is the classic substitution cipher that rotates every letter of the alphabet by a fixed integer distance. With a shift of three, A becomes D, B becomes E, and Z wraps around to C; decryption simply rotates the other way by the same distance. This capability applies that modular letter shift to any text you paste: Latin uppercase and lowercase letters move by your chosen key while digits, spaces, punctuation, and other characters stay put, so phrases like Hello, World! remain readable in structure after encryption. You supply the text, a whole-number shift, and an optional encrypt or decrypt mode.
How a Caesar letter shift encrypts and decrypts text
A Caesar cipher treats the twenty-six Latin letters as a circle. For encryption, each letter is replaced by the letter that sits N places ahead on that circle, wrapping from Z back to A. For decryption, the same key is applied in reverse: each letter moves N places backward, or equivalently the ciphertext is encrypted again with shift negative N.
Case is preserved so an uppercase A with shift three becomes uppercase D, while a lowercase a becomes d. Characters outside A through Z and a through z—including spaces, commas, digits, emoji, and accented letters outside the basic Latin block—are copied unchanged. That design matches textbook examples and puzzle books where only the alphabetic skeleton of a sentence is scrambled.
Mathematically the operation is modular arithmetic modulo twenty-six: normalize the signed integer key into the range zero through twenty-five, map each letter to an index zero through twenty-five, add the key, take the remainder, and map back to a character of the same case. A shift of twenty-six is the identity; a shift of twenty-nine is the same as three; a shift of negative three equals a forward shift of twenty-three. There is no network call, no random seed, and no wall-clock timestamp in the path.
This page implements the classical single-alphabet Caesar shift, not a Vigenère polyalphabetic key, not AES, and not an automatic brute-force cracker that tries every shift for you—those are separate tools and search intents.
Where Caesar cipher tools show up in real work
Introductory cryptography and discrete-math courses assign Caesar drills so students practice modular arithmetic before they meet block ciphers; a single trusted oracle that encrypts and decrypts with an explicit integer key speeds homework demos and auto-graders. Capture-the-flag warm-ups and puzzle hunts still hide ROT-style messages in plain sight, and solvers want a fast, predictable shifter rather than a general cryptanalysis suite. Support and content teams sometimes lightly obfuscate spoilers, quiz answers, or internal labels with a trivial rotation and need the reverse path without installing a language-specific crypto library.
If you need strong authenticated encryption, multi-letter Vigenère keys, Base32 or Base64 encoding, or automatic frequency-analysis key recovery, treat those as separate search intents and landings rather than overloading this classical Caesar shift page.
What you can do with it
Classroom modular-arithmetic demos
Encrypt and decrypt sample sentences with a known integer shift so algebra and intro-crypto lessons share one ground-truth transform.
Puzzle and CTF warm-up shifts
Apply or reverse a fixed letter rotation on challenge strings without writing a one-off script for every problem set.
FAQ
What is a Caesar cipher?
A classical substitution cipher that rotates each Latin letter by a fixed integer distance on the alphabet circle (modulo 26). Non-letters are left unchanged.
How do I decrypt text?
Set mode to decrypt with the same integer shift used to encrypt, or encrypt with the negated shift. Both reverse the rotation.
What if my shift is not an integer?
Caesar keys must be whole numbers; fractional shifts such as 3.5 are rejected and not charged.
Are spaces and punctuation encrypted?
No. Only A–Z and a–z are rotated. Spaces, digits, punctuation, and other characters pass through unchanged.
What does it cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/caesar \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello, World!","shift":3}'const res = await fetch("https://api.kit.forhosting.com/enc/caesar", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hello, World!",
"shift": 3
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/caesar",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hello, World!",
"shift": 3
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/caesar", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hello, World!","shift":3}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hello, World!","shift":3}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/caesar", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hello, World!",
"shift": 3
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.caesar",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Non-integer shifts are rejected immediately with a clear invalid_input error so homework checkers and scripting clients never silently round a bad key.
How a Caesar letter shift encrypts and decrypts text
Because every step is integer arithmetic with no floating-point rounding of the key itself, the transform is fully deterministic: identical text, shift, and mode always produce identical JSON.
What you send and what you get back
Send a required string field named text, a required integer field named shift, and an optional mode field set to encrypt or decrypt. Encrypt mode rotates letters forward by shift; decrypt mode rotates them backward by the same absolute distance. Classic checks include encrypting Hello, World! with shift three to Khoor, Zruog!, decrypting that ciphertext back to the original, and confirming that a fractional shift is rejected rather than rounded. When mode is omitted, encrypt is the default so a minimal payload still does useful work. On success the response echoes mode, the original text, the integer shift you supplied, shift_mod_26 as the effective forward rotation after mode and modulo twenty-six, the transformed result string, length of that result, letters_shifted as a count of how many alphabetic characters were rotated, plus alphabet and cipher labels for clients that assert the profile they hit. Missing text, missing shift, non-string objects for text, unsupported mode values, strings longer than the documented maximum, and any non-integer shift—including floating values such as three point five or numeric strings with a decimal point—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 Caesar 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.
Integration use cases
Lightweight spoiler and label obfuscation
Rotate quiz answers or internal labels with a trivial key and decrypt them later with the same contract in browser or API.