/

Base64 Encode / Decode

Processed Client Side

Encode plain text or files to Base64 or decode Base64 back to text. Supports Unicode, URL-safe mode, and local file encoding.

Input · 2 lines · 50 chars
Length: 50Lines: 2Size: 52 BytesCursor: 1:1
Output
Encoded
Length: 72Lines: 1Size: 72 BytesCursor: 1:1

Bookmark this tool now — skip the search next time you need it.

About Base64 Encode / Decode

This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.

Encode text or a file to Base64, and decode Base64 back to text. Base64 exists because a lot of transports — email bodies, JSON string fields, HTTP headers, data URIs, YAML config — can only carry plain ASCII safely, so binary or unicode data has to be re-expressed using 64 printable characters. This tool handles both directions, is fully unicode-safe so emoji and non-Latin scripts round-trip correctly, and can produce URL-safe output where the + and / characters are swapped for - and _ so the result can be dropped into a URL or a JWT without further escaping. Drop in a file and it returns a complete data URI you can paste straight into CSS or an img tag.

Key features

  • Encode and decode in one place, switched with a single control
  • Full unicode support — emoji, accented characters, and CJK text survive a round-trip intact
  • URL-safe mode replaces + and / with - and _ and drops padding, matching the base64url encoding used by JWTs
  • Drop in a file up to 10 MB and get a ready-to-use data URI with the correct MIME type prefix
  • Clear error messages that distinguish invalid characters from missing padding
  • Live conversion as you type — no need to press a button for text
  • One-click copy of the result, and a Clear button for the file and the text
  • Everything runs in your browser, so credentials, tokens, and private files are never uploaded

How to use it

  1. Choose Encode or Decode with the toggle in the toolbar.
  2. Paste your text into the input pane — the output updates as you type.
  3. To encode a file instead, use the file picker; the output becomes a full data URI.
  4. Turn on URL-safe if the result will be used in a URL, a filename, or a JWT segment.
  5. Click Copy output to put the result on your clipboard.

Tips & common mistakes

  • Base64 is encoding, not encryption. Anyone can decode it in a second — never use it to protect a secret, only to transport one safely.
  • Encoding inflates size by roughly 33%. A 3 MB image becomes about 4 MB of Base64, which is why inlining large images as data URIs slows pages down.
  • If decoding fails, check the length: valid Base64 is a multiple of 4 characters, padded with = signs. A string copied out of a wrapped email or a terminal is often missing its padding or has stray newlines.
  • JWT segments use base64url, not standard Base64 — turn URL-safe on when hand-decoding one, or use the JWT Decoder which handles the whole token.
  • Data URIs are great for small icons and inline SVG, where they save a request. For anything over a few KB, a normal file reference caches better.
  • A Base64 string that decodes to unreadable bytes was probably encoded binary, not text — that is expected for images, fonts, and archives.

Related tools

Browse all 4 Encoding tools

Frequently asked questions

10

Type or paste your text into the input pane and the Base64-encoded result appears instantly in the output. Click "Copy" to grab it.

Switch to "Decode" mode, paste your Base64 string, and the original text is shown immediately. Invalid Base64 characters are flagged with an error.

URL-safe Base64 replaces + with - and / with _ and removes padding = characters, making the output safe to use in URLs and query parameters without percent-encoding.

No — Base64 is an encoding format, not encryption. Anyone with the Base64 string can decode it instantly. Do not use it to protect sensitive information.

Yes — encoding uses UTF-8 under the hood so multi-byte characters and emoji are handled correctly and round-trip without data loss.

Yes. Use the file picker and the tool returns a complete data URI with the correct MIME type prefix, ready to paste into CSS or an img tag. Files up to 10 MB are supported and are processed entirely in your browser.

Valid Base64 has a length that is a multiple of 4, padded with = signs. Strings copied from a wrapped email or a terminal often lose their padding or pick up stray newlines. URL-safe strings using - and _ also need URL-safe mode turned on.

About 33% larger, because every 3 bytes become 4 characters. A 3 MB image becomes roughly 4 MB encoded, which is why inlining large images as data URIs can make a page slower rather than faster.

For small icons and inline SVG it saves an HTTP request and is worth it. For anything more than a few kilobytes, a normal file reference is better because it can be cached separately and reused across pages.

The original data was binary — an image, a font, or an archive — not text. That is expected: Base64 can encode any bytes, but only text decodes into something readable.