Base64 Encoder

Base64 Encoder

Encode any text to Base64 instantly in your browser. Supports UTF-8, shows character count and payload size.

Shift + Enter to Copy · Shift + for tabs
Input String
0 characters
Base64 Output
Speed
Privacy
Local Only
Size
0 KB

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:

  1. Paste your text into the input panel — plain text, JSON, credentials, or any data URI fragment.
  2. Read the output — the Base64-encoded result appears instantly in the output panel.
  3. Copy the result — click Copy or press Shift + Enter to copy to your clipboard.

Need to go the other way? Click Swap & Decode to move the encoded output to the decoder, or switch to the Decode tab at the top.

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 Use Cases

  • Basic authentication headers: When you authenticate to an API with username:password, that string gets Base64-encoded before it's added to the Authorization: Basic header. 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: .env files 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.

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 → Base64 tab in this tool suite, which accepts file uploads and handles binary data directly without any text conversion step.

Related Tools