Base64 Encode / Decode

Reserved · Sponsored728 × 90 · zero layout shift

What this tool does

Base64 turns arbitrary bytes into a compact, ASCII-safe string using 64 printable characters — handy for embedding binary-ish data in JSON, URLs, config files, or HTTP headers. This tool encodes plain text into Base64 and decodes Base64 back into text, entirely in your browser. Unlike a naive btoa/atob call, it routes text through TextEncoder and TextDecoder first, so multi-byte UTF-8 characters — accents, CJK text, emoji — round-trip correctly instead of throwing “character out of range” errors.

How to use

  1. 1
    Pick a direction

    Choose Encode to turn text into Base64, or Decode to turn a Base64 string back into readable text.

  2. 2
    Paste your input

    Drop plain text into the input panel for encoding, or a Base64 string for decoding. Unicode characters are handled correctly in either direction.

  3. 3
    Convert

    Click Convert to run the transformation. The output panel updates instantly with the result, or a red error if the Base64 input is malformed.

  4. 4
    Copy the output

    Use Copy to grab the converted text for pasting into your code, config, or API request. Swap directions any time — your latest output becomes the next input automatically.

Use cases

  • Embed data URIs

    Base64-encode small SVGs or text snippets to inline them as data: URIs in CSS or HTML without a separate network request.

  • Debug Basic Auth headers

    Decode an Authorization: Basic header to check exactly which username:password pair a request is sending during API debugging.

  • Pass values through text-only fields

    Encode a JSON payload or unicode string so it can safely travel through systems that only accept plain ASCII, like some environment variables or legacy form fields.

  • Inspect JWT or token fragments

    Manually decode a Base64 segment pulled from a token or config file to sanity-check its contents before writing custom parsing code.

FAQ

Why does plain atob()/btoa() break on some text?+

btoa/atob operate on "binary strings" where each character must be a single byte (code point 0–255). Multi-byte UTF-8 characters like é, 中, or emoji fail directly. This tool first converts text to UTF-8 bytes with TextEncoder (and back with TextDecoder), so those characters encode and decode correctly.

Is Base64 encryption or compression?+

No. Base64 is a reversible encoding, not encryption — anyone can decode it instantly, and it typically makes data about 33% larger, not smaller. Use it for compatibility (safely embedding bytes in text-only contexts), never for securing sensitive data.

Why did decoding fail with an error?+

Valid Base64 only contains A–Z, a–z, 0–9, +, /, and = padding, with a length that is a multiple of 4 after padding. Extra whitespace, URL-safe variants using - and _, or truncated strings will fail standard decoding — this tool reports the failure rather than silently producing garbage.

Does this tool send my data anywhere?+

No. All encoding and decoding happens locally using your browser's built-in TextEncoder, TextDecoder, btoa, and atob APIs. Nothing is uploaded or stored.

Can I encode files, not just text?+

This tool is built for pasted text input. For binary files (images, PDFs), you would typically read them as bytes and Base64-encode those bytes directly — the same underlying algorithm, but this UI is optimized for text you can type or paste.

Related tools