Encoding

Base64 Encode/Decode

Convert text to Base64 or decode it back, with correct UTF-8 handling. Runs entirely in your browser; nothing you type is ever sent anywhere.

Plain Text
Base64
Encoded output will appear here.

Quick Learn

Base64 turns arbitrary bytes into a string made only of A–Z, a–z, 0–9, +, /, and a trailing = for padding — a character set safe to drop into places that were only ever designed for plain text, like JSON fields, email bodies, URLs, or a Basic Auth header. It isn't encryption and isn't compression; encoded text is actually about 33% larger than the original, since every 3 bytes of input become 4 Base64 characters. Anyone can decode it instantly, so never use Base64 as a way to hide secrets — use it purely as a text-safe transport format.

The most common mistake is handling non-ASCII text with the browser's built-in btoa()/atob() directly — they operate on UTF-16 code units, not bytes, and throw or corrupt data on anything outside Latin1 (accented letters, CJK text, emoji). This tool encodes through TextEncoder first, so café, 日本語, and 🚀 all round-trip correctly, matching how Base64 is actually used in modern JSON APIs and JavaScript code.

Best Practices

  • •Never treat Base64 as encryption — it's a reversible text encoding with no key, decodable by anyone in one line of code.
  • •For binary files (images, PDFs), use a data URI (data:image/png;base64,...) rather than a bare Base64 string, so the receiving context knows how to interpret the bytes.
  • •Base64url (using - and _ instead of + and /, and usually no = padding) is a different variant used in JWTs and URLs — a value copied from one context may need those characters swapped before it decodes elsewhere.
  • •Whitespace and line breaks inside a Base64 string are usually safe to strip before decoding — this tool does that automatically — but don't assume every decoder is that forgiving.

More Encoding Tools

See all Encoding tools

Frequently Asked Questions

Is my text uploaded anywhere?

No. Encoding and decoding both happen entirely in your browser using the native TextEncoder/TextDecoder and btoa/atob APIs — nothing you paste is sent to a server.

Why is my decoded output garbled or throwing an error?

Usually the input isn't valid Base64 for the tool that produced it — a truncated copy-paste, missing padding (=), or characters outside A–Z, a–z, 0–9, +, / will fail to decode. If it came from a URL or a JWT, it may be Base64url (- and _ instead of + and /) rather than standard Base64.

Does this handle emoji and non-English text?

Yes. Input is UTF-8 encoded before Base64 conversion, so accented letters, CJK text, and emoji all round-trip correctly — unlike the raw btoa() function, which corrupts anything outside Latin1.

Can I use this to encode an image or file?

This tool is for text. For images specifically, BizTechLab has a dedicated Base64 Image Encoder under Media Tools that produces a ready-to-use data URI.

Why is the encoded output longer than my input?

Base64 always expands data by roughly 33% — every 3 raw bytes become 4 Base64 characters — because it deliberately trades size for using a smaller, text-safe character set.

Want the engineering deep-dives behind tools like this one?