Cipher Utility

Encoder and Decoder

E

Type text once and see it as Base64, hex, binary, URL and HTML encoding. Switch to Decode to turn any of them back into text.

2. Every format

    Encoding tools

    CodeToola&b becomesUsed for
    E-01 Base64Encode and decode Base64 text. YSZi Binary data inside text: email attachments, data URLs, JSON
    E-02 URL DecodePercent-encode and decode URLs and query strings. a%26b Query strings and form data in URLs
    E-03 Hex DecoderHex to text and text to hex. 61 26 62 Reading raw bytes, colour codes, hashes
    E-04 HTML EntitiesEncode and decode HTML entities. a&amp;b Showing <, > and & as plain text in HTML
    E-06 Text to BinaryTurn text into 8-bit binary code. 01100001 00100110 01100010 Learning how text is stored, puzzles
    E-07 Binary TranslatorBinary to text and text to binary. 01100001 00100110 01100010 Reading binary back as text, in both directions

    Number converters

    CodeToolExampleUsed for
    E-08 Binary to DecimalConvert binary numbers to decimal, with the place values worked out. 01100110 → 102 Reading binary numbers, signed values, homework
    E-09 Decimal to BinaryConvert decimal numbers to binary, including negatives and fractions. 156 → 10011100 Bit patterns, negative numbers in two’s complement
    E-10 Binary to HexGroup bits in fours and turn each group into a hex digit. 11010110 → D6 Writing long bit patterns in short form
    E-11 Hex to BinaryTurn each hex digit into four bits. D6 → 11010110 Reading bit masks, flags and colour codes

    Other tools

    Cipher Utility reference card Series E, encoding

    What an encoder does

    Computers store text as bytes. An encoding writes those bytes in another alphabet so they can pass through a system that only accepts certain characters. Base64 uses 64 safe characters, hex uses 0 to 9 and a to f, and binary uses only 0 and 1. URL and HTML encoding work differently: they leave most text alone and replace only the characters that would break a URL or a web page.

    The encoder on this page first turns your text into UTF-8 bytes and then writes those bytes in each format. Decoding runs the same steps backwards.

    One input in every format

    Here is the word Hi! in each encoding. The bytes are the same every time, only written differently.

    FormatHi! becomesLength
    Binary01001000 01101001 0010000124 digits
    Hex48 69 216 digits
    Base64SGkh4 characters
    URLHi%215 characters

    Binary, decimal and hex numbers

    The number converters work on numbers, where the encoders above work on text. A binary number such as 10011100 is the value 156, and in hex it is 9C. Hex is the short way to write bits, with one hex digit for every four bits. Each converter shows its working: the place values for binary to decimal, the divisions by 2 for decimal to binary, and the groups of four bits for binary to hex and hex to binary.

    Encoding does not hide anything

    Encoded text can look scrambled, but there is no key involved. Anyone who recognizes the format can decode it, and tools like this one do it instantly. If you need to keep a message secret, you need encryption. If you want to know whether a message is encoded or enciphered, the cipher decoder tries both kinds at once.

    Frequently asked questions

    Is Base64 a kind of encryption?

    No. Base64 has no key, so anyone can decode it in one step. It exists to carry binary data through systems that only accept text, such as email. Use real encryption if the content needs to stay private.

    Why does Base64 often end with = signs?

    Base64 turns every 3 bytes into 4 characters. When the input length is not a multiple of 3, one or two = signs pad the output so its length is a multiple of 4.

    What is the difference between hex and binary?

    Both write the same bytes. Binary uses 8 digits (0 or 1) per byte, and hex uses 2 digits from 0 to 9 and a to f. Hex is four times shorter, which is why programmers prefer it.

    Why does URL encoding turn a space into %20 or +?

    Both mean a space. %20 is the general percent encoding used in any part of a URL. The + sign is used for spaces in form data and query strings sent by HTML forms.