Skip to main content

ROT47 Explained: Rotate Every Visible ASCII Character by 47

How ROT47 rotates all 94 printable ASCII characters by 47, why it hides digits and symbols that ROT13 leaves alone, why it is self-inverse, and where to use it.

Published By Li Lei
#rot47 #encoding #ascii #cipher #rot13

ROT47 Explained: Rotate Every Visible ASCII Character by 47

ROT13 is the cipher everyone meets first. It nudges each letter thirteen places forward, so A becomes N, and applying it twice brings you home. It is famous, it is harmless, and it has one stubborn limitation: it only touches the twenty-six Latin letters. Numbers, slashes, brackets and punctuation sail through completely readable. ROT47 is the answer to that gap. It takes the same rotate-by-half-the-alphabet idea and stretches it across the entire block of visible ASCII, so 12345 and https:// get scrambled right along with your words.

This post walks through what ROT47 actually does to a string, how it differs from ROT13 character by character, why a single button both encodes and decodes, and the handful of places it earns its keep. If you just want to run text through it, the ROT47 encoder and decoder does the rotation live as you type.

The 94-character ring

The printable ASCII characters live at code points 33 through 126. That range starts at ! (the exclamation mark) and ends at ~ (the tilde), and in between it holds digits, uppercase and lowercase letters, and almost every symbol you can type without a modifier key. Count them and you get exactly ninety-four characters: 126 minus 33 is 93, plus one for the inclusive endpoint.

ROT47 treats those ninety-four characters as a closed ring and shifts every one of them forward by 47 places. When the shift runs off the end at code 126, it wraps back around to 33 and keeps counting. The arithmetic for any character c in the range is 33 + ((c - 33 + 47) mod 94). Anything outside the ring is left exactly as it is: a space (code 32), a tab, a newline, an accented letter, a Chinese character, an emoji. Those all pass straight through, which is what keeps your line breaks and layout intact after the transform.

Here is the concrete part. Take the full sweep of the ring and you can read the mapping directly. The very first character, !, rotates to P. The digit 0 rotates to an underscore _. Uppercase A becomes p. Lowercase a becomes 2. The at sign @ becomes o. Because the shift is a fixed 47 and the ring is exactly twice that wide, every one of those ninety-four glyphs has a single, predictable partner on the opposite side of the ring.

Worked example: encoding Hello

Let me trace one string by hand, because seeing the codes move makes the whole thing click. I will encode Hello.

  • H sits at code 72. Add 47 and you reach 119, which is w.
  • e sits at code 101. Add 47 and you reach 148, which is past the end. Wrap it: 148 minus 94 is 54, which is 6.
  • l sits at code 108. Add 47 to reach 155, wrap by 94 to get 61, which is the equals sign =.
  • The second l does exactly the same thing: another =.
  • o sits at code 111. Add 47 to reach 158, wrap by 94 to get 64, which is the at sign @.

String it together and Hello becomes w6==@. Notice how unrecognizable it looks. A word made of five letters came out as a letter, a digit, two equals signs and an at sign. That visual scramble across multiple character classes is exactly the ROT47 signature, and it is why a rotated Hello looks nothing like a rotated word from ROT13 (Uryyb, which is still obviously five letters).

How ROT47 differs from ROT13

The difference is entirely about coverage. ROT13 rotates the alphabet only; ROT47 rotates the whole printable set. The cleanest way to feel it is with a string that mixes letters and numbers, like Order 42.

Run Order 42 through ROT13 and you get Beqre 42. The word changed, but the 42 is right there in plain sight, and so is the space. Run the same string through ROT47 and both the word and the number get rewritten into symbol-laced gibberish, while the space (being outside the ring) stays put. When you are trying to hide a URL, a hash, a score or an order ID, the numbers and symbols are usually the part that matters, and ROT13 leaks all of them. ROT47 does not.

There is a family resemblance worth naming. ROT13, ROT47, and even a plain shift like the Caesar cipher encoder are all the same idea applied to different alphabets and different shift amounts. ROT13 is a Caesar shift of 13 over the 26 letters. ROT47 is a shift of 47 over the 94 printable characters. The mechanism never changes; only the size of the ring does.

Why one button does both jobs

ROT47 is its own inverse, which is a fancy way of saying that encoding and decoding are the identical operation. There are no separate modes and no key to remember.

The reason is pure arithmetic. The ring is ninety-four characters wide. A shift of 47 moves each character to the opposite side of the ring. Shift by another 47 and you have moved a total of 94, which is one complete loop, so every character lands exactly back where it started. Forty-seven plus forty-seven equals ninety-four, a full revolution. This is the same property that makes ROT13 self-inverse: 13 is half of 26. Any rotation by half the alphabet undoes itself when applied twice. So you encode Hello into w6==@, and running w6==@ back through the very same transform hands you Hello again.

That self-inverse trick is elegant, but it is also why ROT47 is obfuscation, not encryption. There is no secret. The shift is fixed at 47, the mapping is public, and anyone who recognizes the style can reverse it in a single line of code. If you genuinely need to protect something, reach for real cryptography like AES-GCM or age. ROT47 is for making text non-obvious, not for making it safe.

Where ROT47 actually shines

The honest use cases are small and specific, and they lean into the fact that ROT47 is trivially reversible.

The classic one is hiding a spoiler in a forum or chat thread. You paste your reveal, copy the scrambled output into the post, and add a note that readers can drop it back into the tool to read it. Because ROT47 also hides the episode number, the final score or the link, nobody catches the spoiler from a glance the way they might with ROT13. It carries on an old Usenet habit of scrambling punchlines so a reader has to take a deliberate step to see them.

It also turns up constantly in capture-the-flag and puzzle challenges. When a flag looks like rotated nonsense full of symbols rather than just shifted letters, ROT47 is usually the answer, and you can run the tool either direction to solve a challenge or author a new one. And it makes a vivid teaching aid: because the digits and punctuation visibly move, students can watch every glyph shift, apply the transform a second time, and see the original snap back, which makes modular wrap-around concrete in a way that ROT13 never quite does.

I keep this tool bookmarked for exactly one recurring reason. When I am writing up a bug or a release note and want a sample token or demo path to be visible but not copy-pasteable, I rotate it with ROT47. The string is present in the text, it reads as obvious junk to a skimmer, and any teammate who needs the real value just pastes it back. It is a tiny, friction-free way to say "look but don't reach for this."

The short version

ROT47 is ROT13 with ambition: the same rotate-by-half-the-ring idea applied to all ninety-four printable ASCII characters instead of just twenty-six letters. That single change is why it scrambles digits and symbols, why Hello comes out as w6==@, and why it can hide a URL or a number that ROT13 would expose. It is self-inverse, so one action covers both directions, and it is obfuscation rather than encryption, so use it for spoilers, puzzles and friendly non-obviousness, never for secrets. Try it on your own text in the ROT47 encoder and decoder and watch every glyph move.


Made by Toolora · Updated 2026-06-13