A JavaScript web page that implements ROT-47, a variant of ROT-13.
©2013, Bob Beeman
Updated 2013-07-02 SU @ 11:30 EDT (UT-4)
Read More Important Notice

Rot-47 (and its original variant ROT-13) are some of the oldest tricks on the internet. They are not "cryptographic" codes, because they are not intended to (and don't) prevent anyone from understanding a message. Their real purpose is to prevent a reader from accidentally or unintentionally reading something that the reader would rather leave for another time. For example, the answer to a riddle, or a "spoiler" in a movie review.

Before typing or pasting your own text into the box, or pushing the button, see if you can guess what is already there. Its definitely something you have seen before, and you won't need your spectacles to read it [;-)   You can copy from, paste into, or just type text in the box. Since Rot-47 is its own inverse, repeatedly pushing the "Rot-47" button will toggle the text between plaintext and ciphertext.

More information about "Rot-47"
To use Rot-47 as it was intended, type everything you want people to easily read as you normally would. Paste the part you want to temporarily keep secret into the box in this page and push the "Rot-47" button. Then copy the resulting "ciphertext" into your document or EMAIL, replacing the "plaintext". When reader(s) want to understand that part of your document or message, they can easily translate it back to plain text, using either this page or one like it.

Rot-47 gets its name from the fact that it ROTates (shifts) all of the printable US-ASCII characters (from 33 through 126) by 47 positions. A(#65) becomes p(#112), B(#66) becomes q(#113) ... 3(#51) becomes b(#98), x(#120) becomes I(#73), ~(#126) becomes O(#79) etc. etc. Since the 47-position rotation is half the number of characters in the USASCII block beginning with !(#33) and ending with ~(#126), coding the same thing twice (or any even number of times) gives you back what you started with, and the code (like ROT-13) is its own inverse. The "space"(#32) character and all of the characters below it (#0 - #32) are not transformed, so word boundaries, paragraphs, and tabs are preserved.

The rule is to ignore characters outside the range 33 - 126 inclusive. For those within the range add 47. If this results in a number above 126, subtract 94.

Obviously, the logic of Rot-47 applies only to US-ASCII type text. If you are using Unicode characters from another language (e.g. Chinese, Korean, Arabic), the text will be unaffected. Note, however, that US-ASCII is a strict subset (characters 0 through 127) of Unicode, so any part of your text that is in US-ASCII will be transformed by Rot-47, even if the rest of it is in another character set.

This page is copyrighted "freeware"
©2004, Bob Beeman
That means that although it is copyrighted, it is intended for you to use for education or entertainment. You may use it yourself, copy and redistribute it, or even put it on your own website. I ask only that you not make any changes. If you reuse any of the code, make sure to list me as one of your sources.

My only reward for writing this is the 15 milliseconds of fame I receive from having my name here. Don't deprive me of that.

You can copy this page by simply doing a "Save As" in your browser and putting it somewhere on your hard drive (or your web site). If you stop there the background will be gone. To preserve the background, copy the following file into this same folder, without changing its name, by again using your browser's "Save As". The next time you refresh the page, the background should be restored:


I make NO guarantee of any kind.
This page may contain serious errors.
Use this page entirely at your own risk!