1. Home
  2. Developer
  3. Base64 Encoder / Decoder

Base64 Encoder / Decoder

Base64 that handles UTF-8 properly, plus URL-safe output and file to data URI.

Runs in your browser · No upload Works offline
Base64 result
SGVsbG8sIFRvb2x1bGFoISDwn5GL
Input (UTF-8 bytes)
21
Result length
28 chars
Size change
+33.3%

File → Base64 / Data URI

Or drop a file onto this area. Up to 10 MB; the file is never uploaded.

Text and files are converted in your browser only and are never uploaded.

How to use

  1. Choose Encode and type some text — the Base64 appears instantly. Text is converted to UTF-8 bytes first, so accented letters, CJK and emoji survive the round trip.
  2. Choose Decode and paste a Base64 string to get the original text back. Line breaks, missing = padding and URL-safe characters (- _) are handled automatically.
  3. Turn on URL-safe when the value goes into a URL or file name: - and _ replace + and /, and trailing = is dropped.
  4. In the File → Base64 section, convert an image or any other file (up to 10 MB) to Base64 or a data: URI.

How Base64 works

Base64 (RFC 4648) splits every 3 bytes (24 bits) into four 6-bit groups and maps each to one of 64 characters. Output is therefore about 33% larger than the input, and = pads the end when the length isn’t a multiple of 3.

Variant Alphabet Padding Used in
Standard Base64 A–Z a–z 0–9 + / = Email attachments (MIME), data URIs, HTTP Basic auth
URL-safe (base64url) A–Z a–z 0–9 - _ usually omitted JWTs, URL parameters, file names

Examples

Input UTF-8 bytes Base64
Hi 2 SGk=
é 2 (C3 A9) w6k=
Hello 👋 10 SGVsbG8g8J+Riw==

An emoji takes 4 bytes in UTF-8, so it adds more to the Base64 output than a plain letter does.

Things to know

  • Base64 is not encryption. Anyone can decode it instantly, so never use it to hide passwords or keys. To check integrity, use the Hash Generator.
  • If decoded bytes aren’t valid UTF-8 (an image or PDF, say), you’ll see the first bytes in hex and can save them as a binary file.
  • Inlining large images as data URIs in HTML or CSS defeats caching and bloats the page. It’s best kept for icons of a few KB.

FAQ

Why do other tools garble non-English text?

The browser’s built-in btoa/atob only handle single-byte (Latin-1) characters, so text outside that range throws an error or comes out garbled. This tool uses TextEncoder/TextDecoder for exact UTF-8 conversion.

Is my text or file uploaded?

No. Everything is converted inside your browser and nothing is sent over the network, so it’s safe for auth tokens and internal files.

How do I read what’s inside a JWT?

Each JWT segment is base64url-encoded JSON. The JWT Decoder splits out the header and payload and shows the expiry time.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.