Home Base64 encoder

Base64 encoder

hello is aGVsbG8=. Spaces and line breaks are skipped on the way back, and the URL alphabet with - and _ is not read. The text stays in this browser.

Why this exists

Mail and data URLs write the same text as four-character groups such as aGVsbG8=.

URL encoding’s %20 and Base64’s + are different rules. This page handles standard Base64.

  1. 01How to use it

    Encode takes text, and decode takes Base64. Sample fills hello or aGVsbG8=.

    Copy puts only the result box on the clipboard. Clear empties the input and the result.

    Closing the tab clears the text. This page does not upload a file.

  2. 02What you get

    hello, Hello, and € are aGVsbG8=, SGVsbG8=, and 4oKs. Changing the case of the same Latin letters changes the result.

    One letter M is TQ==, two letters Ma are TWE=, and three letters Man are TWFu.

    Enteredhello

    hello aGVsbG8=
    Hello SGVsbG8=
    € 4oKs
    two Korean characters 7JWI64WV
  3. 03Worth knowing

    YQ returns to a even without padding. YQ=, with only one =, stops.

    /w== is the single byte 0xFF, which is not UTF-8 text, so decode stops.

    A character outside the alphabet, an = in the middle, or a length that leaves a remainder of 1 when divided by 4 is an error.

    This conversion is not a cipher. Anyone can reverse it with the same rule.

Questions

QWhat is hello?
AIt is aGVsbG8=. A two-character Korean string is 7JWI64WV.
QMay the input contain line breaks?
AYes. Spaces and line breaks are removed before reading.
QAre - and _ read?
ANo. Only + and / from the standard alphabet are read.
QIs the text saved?
ANo. It stays in this browser and is not sent to a server.

How this page works it out

This page turns UTF-8 text into standard Base64. The alphabet is A–Z, a–z, 0–9, +, and /. hello is aGVsbG8= and Hello is SGVsbG8=. A two-character Korean string is 7JWI64WV, and € is 4oKs. The URL alphabet with - and _ is not read.

Three bytes become four characters. One byte ends in == and two bytes end in =. M is TQ==, Ma is TWE=, and Man is TWFu. Missing padding is filled in when the remainder fits, and the wrong number of = signs or nonzero leftover bits stops. Spaces, tabs, and line breaks are removed on the way back, so a block wrapped every 76 characters is still read. Encoded output is not wrapped.

Bytes that are not UTF-8 show an error instead of text. /w==, the single byte 0xFF, is one of those cases. This page does not open an image file, and the conversion is not a cipher. More than 100,000 characters stops. The text stays in this browser and is not sent to a server.

  • # base64
  • # utf-8
  • # encode
  • # decode