UTF-8 alphabet, standard or URL-safe
Base64 encode and decode
Base64 writes bytes as letters, digits, plus, and slash. It is how a token or a file preview survives a text field. It does not hide the contents from anyone who can read the alphabet.
Text is encoded as UTF-8 first, then grouped into 6-bit indexes. Padding with = marks a final group that was short. The URL-safe switch replaces + and / with - and _, and drops the padding, which is the form used in JWTs and some query values. Decoding accepts either alphabet. A file is encoded from its raw bytes, so a PNG does not have to be valid text.
The text and the file are read in this tab. Glazlo does not receive the Base64 or the original bytes.
This tool runs in your browser. Turn on JavaScript to use it.
The word Glazlo in standard Base64
Six ASCII letters are six bytes, two exact groups of three. That becomes eight Base64 characters, so there is no = padding.
- Text
- Glazlo
- UTF-8 bytes
- 47 6c 61 7a 6c 6f
- Standard Base64
- R2xhemxv
How to use it
- 1Paste text, or choose a file when you need the bytes rather than a string.
- 2Turn on URL-safe only if the result will be placed where + and / would be awkward.
- 3Copy the encoded text, or decode a string you already have. A file decode can be saved back to disk.
Good to know
- Standard output uses A–Z, a–z, 0–9, +, /, and = for padding.
- URL-safe output uses - and _ and omits padding. Decoding still accepts a padded string.
- If the decoded bytes are not UTF-8 text, use the file decode and save them. Forcing them into a text box would replace bytes.
- Line breaks in a pasted payload are ignored.
Questions
Is Base64 encryption?
No. Anyone can reverse it. Use the encrypt page when the goal is to hide a message behind a passphrase.
Why did a slash or a plus appear?
Those two characters are part of the standard alphabet. Switch on URL-safe before you drop the result into a query string.
Does this match btoa in the browser?
btoa only accepts Latin-1. This page encodes UTF-8, so a character such as 你 survives a round trip. A file uses the raw bytes, not a character set.
Related tools
- Encode text as hexadecimal
Hex is a way to show raw bytes. This page encodes text as UTF-8 first, then prints each byte. Decoding accepts only an even number of digits and rejects bytes that are not UTF-8.
- URL encode and decode
Reserved characters in a URL have jobs. A space, an ampersand, or an equals sign inside a value must be escaped or the query will split in the wrong place.
- Inspect Unicode code points
A character you see may be one code point or several. This page lists the first 80 code points, with U+ notation, decimal, UTF-8 bytes, and a JavaScript escape.