tomai
Log in
Free · Developer Tools

Base64 Encode / Decode

UTF-8 safe Base64 with URL-safe variant and file support

Plain text
Base64

What Is Base64 Encoding?

Base64 converts binary data — or any text — into a safe ASCII string made only of letters, digits, plus signs, slashes, and equals signs. It is not encryption; it is a way to carry data through channels that only handle plain text, such as email attachments, URLs, or JSON fields. This tool encodes and decodes with proper UTF-8 handling, so Chinese, Japanese, emoji, and every other script survive the round trip correctly — a real problem with naive converters that mangle non-ASCII text. It also offers the URL-safe variant from RFC 4648 for embedding in query strings, and can turn a file into its Base64 form. It is built for developers, testers, and anyone moving data between systems.

What this tool can do

  • 🔡 Encode text to Base64 with correct UTF-8 handling
  • 🔄 Decode Base64 back into readable text
  • 🔗 URL-safe variant: dashes and underscores instead of plus and slash, no padding
  • 📎 Convert a file up to 5 MB into Base64
  • 📈 Show byte and character counts for both directions
  • 📋 Copy the result with one click

When you will use it

  • Embedding binary or non-ASCII data inside JSON or XML fields
  • Checking whether a legacy API payload decodes to what you expect
  • Making data safe for URL query parameters
  • Decoding Base64 attachment strings found in logs

Privacy: encoding and decoding happen entirely in your browser — nothing is uploaded, and file conversion is read locally too. Free to use, no account needed.

What Base64 can and cannot do

🌍

Every script survives

Encoding and decoding run through proper UTF-8 handling, so Chinese, Japanese, emoji, and every other script come back byte-identical — where naive converters mangle non-ASCII text.

🔗

URL-safe and forgiving

The RFC 4648 URL-safe variant swaps plus and slash for hyphen and underscore and drops padding, while decoding tolerates whitespace and detects URL-safe input on its own.

📎

Files become Base64

Attach a file up to 5MB and it becomes a Base64 string in a single pass, with a report showing input bytes and output characters so size overhead is visible before you paste it anywhere.

Base64 according to RFC 4648

The standard alphabet is A–Z a–z 0–9 + / with = as padding, and every 3 input bytes become 4 output characters — a ~33% size overhead you should budget for. The URL-safe variant swaps + and / for - and _ so encoded tokens survive inside URLs and filenames.

  • Whitespace and missing padding are tolerated when decoding — copy-pasted values usually just work.
  • Encoding is not encryption: anyone seeing the string can decode it. Use it for transport, never for secrecy.

Frequently asked questions

Why do other tools garble Chinese/emoji text?

JavaScript’s raw btoa() only handles Latin-1. We encode text to UTF-8 bytes first (TextEncoder), so Chinese, Japanese, emoji and every other script round-trip correctly.

What is URL-safe Base64?

A variant (RFC 4648 §5) that replaces + with -, / with _ and drops = padding, so the result can live inside URLs, filenames and JWTs without escaping. Toggle the URL-safe checkbox to encode or decode it.

Is Base64 encryption?

No — it is an encoding, not encryption. Anyone can decode it instantly. Use it for data transport and embedding, never for hiding secrets.

Related tools

Related tools