Base64 Encoder Online — Free, Instant, No Install
Convert any text string to its Base64 representation in one click with this free Base64 encoder online — no installation, no account, and nothing leaves your browser. Paste your text and the encoded output appears immediately, with accurate UTF-8 support for accented characters and emoji.
Base64 encoding adds about 33% to the original size, which is a worthwhile tradeoff when you need binary or special-character data to survive transmission over text-only channels. Whether you're building an API, debugging authentication headers, or embedding a small image in CSS, this tool handles it in milliseconds and shows you the exact output size.
How to Use the Base64 Encoder
Encoding a string takes three seconds:
- Paste your text into the input panel — plain text, JSON, credentials, or any data URI fragment — and the encoded output appears instantly in the output panel as you type.
- Read the output — the Base64-encoded result is ready in the output panel with a green "Valid" badge confirming successful encoding.
- Copy the result — click Copy or press Shift + Enter to copy the encoded string to your clipboard in one keystroke.
Need to go the other way? Click Swap & Decode to move the encoded output directly to the decoder, or switch to the Decode tab at the top.
Base64 Encode Examples
Here are concrete examples showing exactly what the encoder produces for different inputs.
| Input | Base64 Output |
|---|---|
Hello |
SGVsbG8= |
hello world |
aGVsbG8gd29ybGQ= |
{"user":"admin"} |
eyJ1c2VyIjoiYWRtaW4ifQ== |
café |
Y2Fmw6k= |
| `` (empty string) | `` (empty output) |
The = characters at the end are Base64 padding — they bring the encoded length to a multiple of 4 and are a normal, expected part of the output.
Base64 Encoding — What It Is and Why It Matters
Base64 is a binary-to-text encoding scheme that represents arbitrary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. The = padding character brings encoded chunks to a uniform length.
The core problem it solves is straightforward: many communication protocols — email (MIME), HTTP headers, JSON fields — were designed for plain ASCII text. Feed them raw binary data (like an image or a byte sequence with null characters) and they break. Base64 encodes that data into a safe string that travels anywhere without corruption. It's not encryption — the output is trivially reversible — but it ensures your data arrives intact.
Common Mistakes with Base64 Encoding
Knowing the pitfalls saves debugging time:
- Double-encoding: If you run Base64 output through the encoder a second time, you get a double-encoded string that looks valid but is not what the recipient expects. Always encode the original raw value, not an already-encoded one.
- Confusing Base64 with Base64URL: Standard Base64 uses
+and/as the 62nd and 63rd characters. Base64URL replaces them with-and_to make the string URL-safe (used in JWTs and OAuth tokens). They look similar but are not interchangeable. - Treating Base64 as encryption: Base64 is encoding, not security. Anyone with the encoded string can decode it instantly without any key. Never use it to protect passwords or secrets.
- Missing the UTF-8 step: The browser's native
btoa()throws aInvalidCharacterErrorfor any character outside Latin-1. This tool handles that automatically usingencodeURIComponentbefore encoding — but if you're writing your own code, you must do the same. - MIME line breaks: Some Base64 implementations (like email MIME) insert a line break every 76 characters. This tool produces a single unbroken string. If you need line-wrapped output for MIME, add line breaks every 76 characters manually.
Common Use Cases
- Basic authentication headers: When you authenticate to an API with
username:password, that string gets Base64-encoded before it's added to theAuthorization: Basicheader. Encoding it here lets you inspect or manually construct those headers for testing. - Embedding images in HTML or CSS: Small icons and data URIs use
data:image/png;base64,...to inline images directly into stylesheets or HTML, eliminating an extra network request. Start with the Image → Base64 tab for file uploads, or encode raw text fragments here. - JWT debugging: JSON Web Token headers and payloads are Base64URL-encoded. Encoding raw JSON here lets you inspect what a JWT section should look like before it's signed.
- Storing binary config in environment variables:
.envfiles and YAML configs are text-only. A Base64-encoded certificate, private key, or binary blob travels safely as a single-line string in any config format. - Email attachments (MIME): Email clients encode binary file attachments as Base64 before transmitting them. Understanding the encoded format is useful when debugging MIME payloads or building mail-sending code.
- Inspecting API responses: Some APIs return Base64-encoded fields — particularly for binary data or file contents. Decode the raw value here to see the original content when analyzing payloads.
Frequently Asked Questions
Is Base64 encoding the same as encryption?
No — Base64 is an encoding scheme, not encryption. It transforms binary data into readable ASCII text, but the process is completely reversible with no key or secret required. Anyone who sees a Base64 string can decode it instantly. Never use Base64 as a security measure; use proper encryption algorithms for sensitive data.
Does this Base64 encoder support UTF-8, emoji, and accented characters?
Yes. The encoder uses encodeURIComponent combined with btoa internally to correctly handle the full UTF-8 range, including accented characters (é, ñ, ü), CJK characters, and emoji. Standard btoa() alone throws an error on any character outside Latin-1, so the UTF-8 step is essential for real-world text.
What is the difference between Base64 and Base64URL?
Standard Base64 uses + and / as the 62nd and 63rd characters. Base64URL replaces them with - and _, making the encoded string safe to include in URLs and filenames without percent-encoding. JWTs use Base64URL; most other contexts use standard Base64. To convert: replace + with - and / with _ in the output, then strip any = padding.
How much larger is the Base64 output compared to the original input?
Base64 output is always approximately 33% larger than the input. Every 3 bytes of input become 4 Base64 characters. A 1 KB string encodes to roughly 1.37 KB. The size indicator at the bottom of the tool shows the exact output size in KB so you can plan accordingly.
What happens if I encode an empty string in Base64?
Encoding an empty string produces an empty output — this is the correct behavior per RFC 4648. There are zero bytes to encode, so there are zero characters to output. No padding is added. If you see an error instead of an empty result, the input likely contains invisible whitespace characters.
Does Base64 encoding work with emoji?
Yes, emoji encode correctly because this tool applies full UTF-8 handling before encoding. For example, the emoji 🚀 encodes to 8J+Sug==. Each emoji is first converted to its multi-byte UTF-8 representation, then those bytes are Base64-encoded. The reverse works equally well — paste the encoded value into the decoder to get the original emoji back.
Can I use this tool to encode binary files, not just text?
This tool is designed for text input (strings). To encode binary files such as images or PDFs to Base64, use the Image to Base64 converter, which accepts file uploads and handles binary data directly without any text conversion step.
Resources
- MDN — btoa() reference — Official documentation for the browser API that powers Base64 encoding on the web.
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings — The IETF standard that formally defines Base64 encoding and its variants.
- web.dev — The nuances of Base64 encoding strings in JavaScript — A thorough guide to handling Unicode and the UTF-8 step correctly in JavaScript.