ROT-N cipher
Choose any shift from 0 to 25: with 13, Hello, World! becomes Uryyb, Jbeyq!, with 3 you get the textbook Caesar cipher, and decoding moves each letter back by the same amount. Digits and punctuation never move. 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!
- N
- 13
- Calculation mode
- Encode
- Result
- Uryyb, Jbeyq!
- N effective
- 13
- Length
- 13
- Letters rotated
- 10
ROT-N is the general form of the familiar ROT13 letter-substitution cipher: you pick any whole-number rotation N, and every Latin letter advances that many places around the alphabet while digits, spaces, and punctuation stay put. Because the alphabet is a circle of twenty-six letters, the transform wraps from Z back to A and from z back to a, and uppercase stays uppercase so messages keep their shape. Encode mode applies plus N; decode mode applies minus N so the same tool both hides and reveals text when you know the shift.
How rotating letters by N works
ROT-N treats the twenty-six Latin letters as a modular circle. For each uppercase letter, map A to zero through Z to twenty-five, add the effective shift, take the remainder modulo twenty-six, and map back to a letter of the same case. Lowercase letters follow the identical arithmetic inside a through z.
Characters outside those two ranges—including digits, whitespace, punctuation, emoji, and non-Latin scripts—are copied unchanged so the skeleton of a sentence survives the transform. Encode mode uses the integer N you supply as a forward rotation; decode mode uses the modular inverse, which is equivalent to rotating by twenty-six minus N when N is not zero. A shift of zero is the identity map; a shift of thirteen is classical ROT13 and is an involution; a shift of three reproduces the textbook Caesar example many curricula still teach.
Optional mode defaults to encode when omitted.
Validation rules, out-of-range shifts, and common pitfalls
The shift N must be a whole number from zero to twenty-five inclusive. Mixed-case phrases preserve case because upper and lower alphabets rotate independently. Non-ASCII letters such as accented Latin or Cyrillic are not rotated by this classical definition; they pass through so the algorithm stays faithful to the ROT family people search for.
Do not treat the result as encryption: anyone who knows N can reverse the text instantly, and the product page should never market ROT-N as a security control for secrets, passwords, or personal data. Prefer this landing when the query is literally rot-n cipher, rot n encoder, or rotate letters by N; fixed ROT13, ROT5, ROT18, or a general Caesar page that markets historical cipher keys answer related but distinct search intents and should stay separate tools.
What you can do with it
Variable-shift puzzle and CTF warm-ups
Encode or decode challenge strings with any N from 0 to 25 without writing a one-off script for each problem set.
Classroom modular-arithmetic demos
Show that encode with N and decode with the same N restore the original text, and that out-of-range shifts fail clearly.
FAQ
What is a ROT-N cipher?
A classical substitution that rotates each Latin letter by an integer N positions on the alphabet circle (modulo 26). Non-letters are left unchanged.
How do I encode and decode?
Send text and n with mode encode (default) to rotate forward. Use the same n with mode decode to rotate backward and recover the original Latin-letter content.
What if my shift is out of range?
N must be a whole number from 0 to 25 inclusive; values such as 26, −1, or 3.5 are rejected and not charged.
Are spaces and punctuation rotated?
No. Only A–Z and a–z move. Spaces, digits, punctuation, and other characters pass through unchanged so sentence structure stays readable.
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/rot-n \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello, World!","n":13}'const res = await fetch("https://api.kit.forhosting.com/enc/rot-n", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hello, World!",
"n": 13
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/rot-n",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hello, World!",
"n": 13
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/rot-n", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hello, World!","n":13}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hello, World!","n":13}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/rot-n", 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!",
"n": 13
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.rot_n",
"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
This capability accepts non-empty text and an integer N in the closed range zero through twenty-five, rejects out-of-range shifts with a clear invalid_input error, and returns the rotated string plus counts you can assert in tests. Successful API calls use prepaid KIT balance at $0.002 per item; validation failures are not charged.
How ROT-N rotation works and what the response contains
Send a JSON body with required string field text and required integer field n (aliases such as shift and rot are accepted). On success the response includes the original text, n, mode, n_effective as the forward rotation after applying mode, result as the transformed string, length of the input, letters_rotated counting how many alphabetic characters moved, plus alphabet and cipher labels for clients that pin a profile. Identical inputs always produce identical JSON because the path is pure character arithmetic with no network call, no random seed, and no wall-clock timestamp.
Validation rules, out-of-range shifts, and common pitfalls
Values such as twenty-six, negative one, three point five, or a non-numeric string fail immediately with invalid_input and an English message that states the shift is out of range or not an integer. That strict range is intentional: ROT-N search intent expects a named rotation on the alphabet circle, not silent wrapping of arbitrary integers that would hide homework mistakes. Missing text, non-string text, empty strings, missing n, and unsupported mode values also raise invalid_input and are not charged on the prepaid API. Whitespace-only strings that still have length greater than zero are accepted; only letters rotate, so a string of spaces returns itself with letters_rotated equal to zero.
API usage, pricing, classroom workflows, and practical limits
Call the free in-browser ROT-N cipher for puzzle drafting, forum spoilers, lecture demos, and one-off checks without installing openssl or writing a one-liner in every language. A typical classroom workflow shows students that encoding with N and decoding with the same N restores the original message, then contrasts that identity with a true keyed cipher later in the syllabus. Support playbooks can reverse lightly obfuscated ticket notes that staff intentionally wrote with a shared rotation. Pair with Base64 or URL-encoding tools only when a later transport step needs a different alphabet—keep ROT-N on its own landing so SEO intent for variable letter rotation stays sharp and does not cannibalize fixed-shift or full cryptanalysis pages. 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 the engine rejects the request. Puzzle sites can precompute answers for display and reveal them on demand with the same endpoint by switching mode to decode. Authors shipping SDKs can map the result field straight into a copy button while n_effective and letters_rotated make OpenAPI examples self-explanatory. Keep payloads to ordinary text sizes appropriate for a Worker isolate item call; this tool is for messages and snippets, not multi-megabyte binary blobs.
Integration use cases
Spoiler and label obfuscation
Rotate quiz answers or internal labels with a shared N, then reverse them later with mode decode in browser or API.