Developer Tools

Base64 Encoder and Decoder

Base64 represents binary data using 64 printable characters, so it can travel through systems that only accept text — email bodies, JSON fields, data URLs. The usual browser implementation breaks on anything outside Latin-1, which is why an emoji so often comes back as mangled bytes. This encoder goes through UTF-8 properly, so any text round-trips exactly.

Runs entirely in your browser — nothing you paste is uploaded.

Direction

Turn text into Base64.

How to

How to use the Base64 Encoder

  1. 1

    Choose encode or decode

    Encoding turns text into Base64; decoding turns Base64 back into text. The tool tells you immediately if the input is not valid Base64.

  2. 2

    Paste your text or data

    Type, paste from the clipboard, or drop in a file. Conversion happens as you type, with no button to press.

  3. 3

    Pick a variant if you need one

    Turn on URL-safe output to replace the plus and slash characters and drop the padding, so the result survives a query string untouched.

  4. 4

    Copy or download

    Copy the result to the clipboard or save it as a file. Both panes show byte counts, since Base64 always grows the data by roughly a third.

Examples

Base64 Encoder examples

Text with an emoji

Input
👍
Output
8J+RjQ==

Encoders built on btoa alone throw an error here, and the common escape/unescape workaround mangles lone surrogates. Going through UTF-8 bytes gives the correct four-byte encoding.

A value for a query string

Input
a?b/c+d
Output
YT9iL2MrZA (URL-safe)

Standard Base64 uses plus and slash, both of which mean something else in a URL. The URL-safe variant swaps them for minus and underscore and drops the padding.

Something that is not text

Input
iVBORw0KGgo=
Output
Decoded, but not valid UTF-8 text

That is the start of a PNG file. Rather than showing replacement characters that look like a successful decode, the tool says plainly that the data is binary.

Why use it

What the Base64 Encoder gives you

Round-trips any text

Emoji, accents, Chinese, Arabic and combining marks all encode and decode back to exactly what you started with.

Errors that say what is wrong

Invalid input names the character that caused it and whether the length is even possible for Base64, instead of failing with a bare exception.

Handles pasted whitespace

Base64 copied from an email header or a certificate arrives with line breaks. They are stripped automatically rather than rejected.

Nothing is transmitted

Encoding runs in the page, so a token or a credential pasted here never reaches a server.

Good to know

Base64 Encoder limitations

  • Base64 is encoding, not encryption. Anyone can decode it, so it protects nothing on its own.
  • The output is about 33% larger than the input, which matters when the result goes into a size-limited field.
  • Decoded binary data is reported rather than rendered — this tool does not preview images or files.
  • Very large inputs are held in memory, so a file beyond a few megabytes may be slow in the browser.

Summary

Base64 Encoder in short

  • Base64 encodes binary as text; it does not encrypt or protect anything.
  • Emoji and accented characters round-trip correctly here and break in many other tools.
  • The URL-safe variant replaces plus and slash so the result is safe in a query string.
  • Expect the output to be roughly a third larger than the input.
  • Everything runs in your browser, so pasted secrets are not transmitted.

FAQ

Base64 Encoder questions

Why do other Base64 tools break on emoji?

They call btoa directly, which only accepts code points below 256 and throws on anything else. The common workaround using escape and unescape relies on two functions deprecated years ago and mangles lone surrogates. Encoding UTF-8 bytes first avoids both problems.

Is Base64 a form of encryption?

No, and treating it as one is a genuine security mistake. Base64 is a reversible encoding with no key — anyone who sees the string can decode it in one step. Use it to make binary data safe to transport, never to hide anything.

What is URL-safe Base64?

The variant defined in RFC 4648 §5. Standard Base64 uses plus and slash, which are reserved in URLs, so the URL-safe form uses minus and underscore instead and usually drops the trailing equals padding. JSON Web Tokens use it.

What are the equals signs at the end for?

Padding. Base64 works in groups of three input bytes, and equals signs mark where the final group was short. Decoders can usually reconstruct it, which is why the URL-safe variant omits it, and this tool restores it automatically.

Why did my data get bigger?

Base64 represents every three bytes as four characters, so the output is about 33% larger, before any line breaks. That is the cost of making binary data safe to put in a text field.

Why does Base64 from an email have line breaks in it?

MIME wraps encoded content at 76 characters. Those breaks are not part of the data, so they are stripped before decoding here — pasting a certificate or an email attachment works without cleaning it up first.

Can I decode Base64 that is not text?

The decoding will succeed, but the result is bytes rather than characters. Rather than showing question marks that look like text, the tool reports that the data is not valid UTF-8, which usually means it is an image or another binary file.

Is this the same as a data URL?

A data URL wraps Base64 in a prefix that names the media type, like data:image/png;base64, followed by the encoded bytes. The encoding is identical; the prefix is what tells a browser how to interpret it.

Is anything I paste here sent to a server?

No. The conversion is a few lines of JavaScript running in this page. That matters here more than most places, since Base64 tools are often used on tokens and credentials.

Discover

Related developer tools