✦ tomai
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 is a way to carry arbitrary bytes through channels that only accept plain text, by re-encoding every 3 bytes as 4 ASCII characters drawn from letters, digits, plus, slash and padding equals signs. It is an encoding, not encryption: anyone can reverse it, so it adds zero secrecy. This tool encodes with real UTF-8 byte handling through text encoders and decoders, which matters because naive converters built on raw 16-bit code units silently mangle Chinese, Japanese, Korean, emoji and every other non-Latin script. It also speaks the URL-safe dialect that swaps plus and slash for dash and underscore and drops padding, and it can convert a local file into its Base64 form for pasting into JSON, XML or data URLs.

The UTF-8 round trip, done properly

  • Encode any text to standard Base64, or to the URL-safe form when the checkbox is on
  • Decode with whitespace ignored, automatic recognition of dash and underscore input, and padding repaired before parsing
  • Convert a file up to 5 MB through a local file reader, showing file name and byte size in the opposite box
  • Live byte and character counts after each direction, plus one-click copy and instant clear of both boxes

Jobs it quietly handles

  • Embedding binary or non-ASCII payloads inside JSON or XML fields that reject raw bytes
  • Checking what a Base64 blob from logs, email attachments or legacy APIs actually decodes to
  • Preparing values that must survive URL query strings without plus signs turning into spaces

Where it says no

Files above 5 MB are refused with an explicit too-large message rather than freezing the tab, and undecodable input surfaces a decode error instead of guessing. Decoding never validates what the bytes mean, it only restores them, so a successful decode of random text proves nothing about its origin. Treat every decoded secret as public, because Base64 hides nothing.

Privacy: both boxes live and work entirely on your device; text and files are read locally and no byte is ever uploaded anywhere.

Last updated · 2026-09-01

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