Encoder

Select the substitution method that you want to use and enter the text that you want to encode.

At the downloads section you will find some fonts that can be used when the substitution method used is either ROT13, Atbash or Zebra. If you define a custom substitution method, you will need to create your own font, as indicated in the advanced documentation.

Input

Substitution method:

Plaintext alphabet:
{{plainAlpha}}
Ciphertext alphabet:
{{cipherAlpha}}


Output

{{cipherText}}

Dynamic encoding

If you want to encode your text at your server, or you need to encode content generated dynamically, you only have to implement an encoding function.

It's easy! Here you have examples in some of the most popular languages:


PHP

function encrypt($plain, $cipher, $text) {
    $plain = $plain . strtoupper($plain);
    $cipher = $cipher . strtoupper($cipher);
 
    $newText = '';
    for($i=0; $i<strlen($text); $i++)  {
        $c = $text[$i];
        $index = strrpos($plain, $c);
        if($index && $index < strlen($cipher)) {
            $newText = $newText . $cipher[$index];
        } else {
            $newText = $newText . $c;
        }
    }
    return $newText;
}

See live demo


JavaScript

function encrypt(plain, cipher, text) {
    plain = plain + plain.toUpperCase();
    cipher = cipher + cipher.toUpperCase();
 
    var newText = '';
    for(var i=0; i<text.length; i++) {
        var c = text.charAt(i);
        var index = plain.indexOf(c);
        if(index >= 0 && index < cipher.length) {
            newText += cipher.charAt(index);
        } else {
            newText += c;
        }
    }
    return newText;
}

See live demo


Python

def encrypt(plain, cipher, text):
    plain += plain.upper()
    cipher += cipher.upper()
 
    newText = ''
    for c in text:
        index = plain.find(c)
        if(index >= 0 and index < len(cipher)):
            newText += cipher[index]
        else:
            newText += c
        
    return newText;

See live demo


Java

public static String encrypt(String plain, String cipher, String text) {
    plain = plain + plain.toUpperCase();
    cipher = cipher + cipher.toUpperCase();
 
    String newText = "";
    for(int i=0; i<text.length(); i++) {
        char c = text.charAt(i);
        int index = plain.indexOf(c);
        if(index >= 0 && index < cipher.length()) {
            newText += cipher.charAt(index);
        } else {
            newText += c;
        }
    }
    return newText;
}

See live demo


C#

public static String encrypt(String plain, String cipher, String text) {
    plain = plain + plain.ToUpper();
    cipher = cipher + cipher.ToUpper();
 
    String newText = "";
    for(int i=0; i<text.Length; i++) {
        char c = text[i];
        int index = plain.IndexOf(c);
        if(index >= 0 && index < cipher.Length) {
            newText += cipher[index];
        } else {
            newText += c;
        }
    }
    return newText;
}

See live demo

Fork me on GitHub