ROT47 Character Substitution Cipher

The ROT47 (Caesar cipher by 47 chars) is a simple character substitution cipher that replaces a character within the ASCII range [33, 126] with the character 47 character after it (rotation) in the ASCII table. It is an invertible algorithm i.e. applying the same algorithm to the input twice will get the origin text.
The page provides a Javascript implementation online ROT47 encoder/decoder.
Example: This page provides a Javascript online web-based ROT47 Encoder/Decoder.
will be translated to:
%9:D A286 [email protected]:56D 2 y2G2D4C:AE @?=:?6 H63\32D65 #~%cf [email protected][email protected]]

ROT47: same action can be used for encoding and decoding
ROT47 is a derivative of ROT13. ROT47 introduces mixed letters and symbols, therefore, the encoded text looks more obvious that text has been enciphered. The following is an online ROT47 cipher implemented by Javascript.


The ROT47 can be easily implemented by modern programming language in many many ways, e.g. using a lookup table. For example, the following PHP code uses strstr to convert the text by using a lookup table.

    function str_rot47($str)
    {
      return strtr($str, 
        '!"#$%&\'()*+,-./0123456789:;<=>[email protected][\]^_`abcdefghijklmnopqrstuvwxyz{|}~', 
        'PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>[email protected]'
      );
    }
Alternatively, ROT47 can be implemented by computing directly the ROT47-ed ASCII of each given character.
    function Rot47(const s: string): string;
    var
      i, j: integer;
    begin
      Result := s;
      for i := 1 to Length(s) do
      begin
        j := Ord(s[i]);
        if (j in [33..126]) then
        begin
          Result[i] := Chr(33 + ((j + 14) mod 94));
        end;
      end;
    end;

API (Application Programmer Interface)

The API following has a rate-limit 1 call per second.
https://helloacm.com/api/rot47/?s=Hello ROT47
It will return JSON-encoded data:
"w6==@ #~%cf"
If $_GET parameter s is not specified, this API will use the $_POST variable s instead.
curl -X POST https://helloacm.com/api/rot47/ -d "s=ROT47 Rocks!"

Pascal/Python/VBScript
Javascript Download

Use the ROT47 function in your application easily; rot47.pas - rot47.py - rot47.vbs (Is VBScript Dead?) - rot47.js - rot47c.js (Compressed)

Link here!

Just paste the HTML code, shown below, onto the site of your choice.
    <a href="https://rot47.net" title="Online ROT47 Encoder/Decoder">Online ROT47 Encoder</a>
Plain text example:
Online ROT47 Encoder

Share This

Page Edited: