Base64 Encoder
Convert text or a file into Base64. Unicode is handled correctly, and you can produce URL-safe output or a ready-to-use data URI for embedding images.
- Runs in your browser
- No sign-up
- Free to use
How to use Base64 Encoder
- Type or paste text into the input, or choose Encode a file to pick any file from your device.
- Tick URL-safe if the result will go into a URL or filename, and choose line wrapping if you need it.
- For files, tick Data URI to get a string that can be used directly in HTML or CSS.
- Copy the Base64 output or download it.
Base64 Encoder features
Correct UTF-8 handling
Emoji, accents and non-Latin scripts are encoded properly instead of throwing an error.
Text and files
Encode typed text live, or any file up to 20 MB such as an image, font or certificate.
URL-safe variant
Replaces + and / with - and _ and removes padding, as used in JWTs and query strings.
Data URI output
Prefixes the result with the file's media type for embedding in src or url().
Line wrapping
Break output at 64 or 76 characters for PEM blocks and MIME email bodies.
Stays in the browser
Neither your text nor your files are transmitted.
When to use Base64 Encoder
- Embedding a small icon or font directly in CSS or HTML.
- Building a Basic Authentication header from user:password.
- Putting binary data into JSON, XML or an environment variable.
- Preparing an attachment or key for a system that accepts only text.
Base64 Encoder FAQ
What is Base64 used for?
It represents binary data using 64 printable characters so that it can travel through systems designed for text, such as email, JSON, URLs and HTML attributes.
Is Base64 encryption?
No. It is an encoding that anyone can reverse instantly. It provides no secrecy, so never use it to protect passwords or sensitive data.
Why is the output longer than the input?
Every three bytes become four characters, so Base64 is about 33% larger than the original, plus padding and any line breaks.
When should I use the URL-safe option?
Whenever the string appears in a URL, a cookie or a filename. Standard Base64 uses + and /, which have special meanings there, and = padding, which needs escaping.
What is a data URI?
A string of the form data:image/png;base64,… that embeds a file's content directly where a URL would go. It avoids an extra request but increases the size of the page, so it suits small assets only.
How Base64 encoding works
Base64 takes input three bytes at a time, which is 24 bits, and splits them into four groups of six bits. Each six-bit group has a value from 0 to 63 and is written as one character from a fixed alphabet: A–Z, a–z, 0–9, plus and slash. When the input length is not a multiple of three, the final group is padded with one or two equals signs.
Text has to be turned into bytes before it can be encoded. This tool uses UTF-8, the encoding of the web, so a character such as é becomes two bytes and an emoji four. Using the same encoding on the decoding side is what guarantees you get the original text back.