How it works
Base64 takes the data three bytes (24 bits) at a time and splits it into four groups of 6 bits. Each 6-bit group maps to one of 64 characters: A–Z, a–z, 0–9, + and /. If the data does not divide evenly, = padding is added at the end.
Examples: Hello → SGVsbG8=; café (encoded as UTF-8) → Y2Fmw6k=.
Because every 3 bytes become 4 characters, Base64 output is about a third larger than the original.
Where Base64 is used
- Email attachments, which travel through systems designed for text.
- Data URIs that embed small images directly in HTML or CSS:
data:image/png;base64,… - JSON and APIs that need to carry binary data, such as an uploaded file.
- JSON Web Tokens (JWTs), whose header and payload are URL-safe Base64.
- HTTP Basic authentication headers.
Base64 is not encryption
Anyone can decode Base64 instantly; it hides nothing. Never use it to “protect” passwords or personal data. A JWT’s payload, for example, can be read by anyone who has the token — its security comes from the signature, not the encoding. To check that data has not been altered, use a hash; see the checksum guide.
Encode and decode
- In the Base64 Encoder and Decoder, type or paste text and select Encode text, or paste Base64 and select Decode Base64. Text is handled as UTF-8, so accents and emoji survive the round trip.
- Tick URL-safe for values that go into a URL, file name or JWT. It uses
-and_instead of+and/and drops the=padding. - For files, switch to File, choose a file (up to 25 MB) and copy the output — optionally as a ready-made data URI.
- To turn Base64 back into a file, paste it, give the file a name with the right extension and download it.
When not to use data URIs
Embedding images as Base64 saves a separate request but makes the HTML or CSS larger and prevents the browser from caching the image separately. It suits tiny icons; for anything larger, a normal image file — compressed with the Image Compressor — is usually faster.
Frequently asked questions
Why does decoded text look like random symbols?
The Base64 probably contains binary data, such as an image or PDF, not text. Use the file decoder and save it with the correct extension.
What does the = at the end mean?
It is padding, added when the original length is not a multiple of three bytes. URL-safe Base64 often leaves it out.