Base64

Base64 Encode

Details

How to use Base64 Encode

What the tool does, how to run it, and what to expect from the result.

How to encode text to Base64

Base64 exists to move arbitrary bytes through channels that only tolerate printable text, such as email headers, JSON string fields, XML documents, and data URIs. It is the standard answer whenever a system rejects control characters or raw binary but must still carry them.

Everything here happens in your browser. The text is converted to UTF-8 bytes with TextEncoder and then to Base64, so the transformation is exact and reversible, and no copy of your input ever leaves the machine.

  • Paste or type the text you want to encode into the input box.
  • Read the Base64 result from the output panel, which updates as you type.
  • Copy the result with the copy button.
  • If the destination is a URL, a filename, or a JWT, convert plus to minus and slash to underscore first, because standard Base64 will break in those contexts.
  • To reverse the operation later, paste the string into the Base64 decoder.
Tips

Getting a better result out of Base64 Encode

Specific settings and thresholds, not general advice.

  • Base64 is an encoding, not encryption. Anyone can reverse it in one line of code, so a Base64 string in a config file, a cookie, or a URL is public knowledge. If you need secrecy, encrypt first and Base64 the ciphertext, never the plaintext.
  • Base64 costs you 33% in size: every 3 bytes of input become 4 characters of output, so a 300 KB image becomes roughly 400 KB of text. That is the exact reason inlining images as data URIs makes a page bigger, not smaller.
  • The output uses the standard RFC 4648 alphabet (A-Z, a-z, 0-9, plus, slash) with equals-sign padding. If you are putting the result in a URL or a filename, the plus and slash characters will break it. You need base64url, which swaps them for minus and underscore.
  • The tool encodes text as UTF-8 first, so accented characters, CJK, and emoji all survive the round trip. This is what the naive btoa(text) call in JavaScript gets wrong: it throws an InvalidCharacterError on any character above U+00FF.
  • Output is one continuous line with no wrapping. Email MIME bodies (RFC 2045) expect a line break every 76 characters and PEM certificates every 64, so if you are pasting into either of those you must wrap the string yourself.
Limits

What Base64 Encode does not do

The honest boundary, so you do not lose time finding it yourself.

  • It encodes text, not files. There is no file picker here, so you cannot drop a PNG in and get its data URI. That is a separate job for an image-to-Base64 tool.
  • It produces standard Base64 only. There is no base64url mode and no option to strip the padding, both of which JWTs and URL parameters require.
  • There is no line-wrapping option, so the output is not directly valid as a MIME message body or a PEM block.
  • It does not prepend a data URI prefix such as data:text/plain;base64, so the output is the payload alone.
Reference

Terms used on this page

Short, plain-language definitions for the formats and settings above.

At a glance

Who Base64 Encode is for

A quick way to understand who this helps, what it solves, and where it connects next.

Best fit

Developers, engineers, and anyone working with encoded data.

Ideal for

Quick encoding, decoding, and inspection without a backend or install.

FAQ

Common questions

Short answers for the questions people usually have before trying a utility like this.

Is the Base64 encoder free?

Yes. It is completely free to use, with no signup, no account, and no paywall.

Do I need to install anything?

No. It runs in any modern browser on desktop or mobile, with nothing to download and nothing to configure.

Does it stay local?

Yes. The text you paste is processed entirely in your browser and never uploaded to a server.

Why is my Base64 string longer than the original text?

Base64 represents 3 bytes of input using 4 printable characters, which is a fixed 4-to-3 expansion, or about 33% growth, plus up to 2 padding characters. This is unavoidable: the whole point of the encoding is to survive systems that only handle a limited set of printable characters, and buying that safety costs a third of your bytes. If size matters, compress before you encode, not after, because Base64 output does not compress well.

Can I use Base64 to hide an API key or a password?

No. Base64 offers zero security. It is a public, reversible, standardised transformation, and every browser has a built-in atob() function that undoes it instantly. Treating a Base64 blob as a secret is one of the most common findings in a source code audit. Use a secrets manager or environment variables, and if the value must travel through an untrusted channel, encrypt it.

What is the difference between Base64 and base64url?

They encode identical data but use different characters for the last two symbols of the alphabet. Standard Base64 uses plus and slash, which have special meanings in URLs and file paths. Base64url substitutes minus and underscore, and usually drops the trailing equals-sign padding. JWTs, URL query parameters, and many APIs use base64url, so a standard Base64 string pasted into those places can decode incorrectly or fail outright.

Is anything sent to a server when I encode?

No. The encoding runs entirely in your browser using TextEncoder and the built-in btoa function. Nothing you type is transmitted, logged, or stored anywhere. Once the page is loaded you can disconnect from the network and it will keep working.

Why do some Base64 strings end in one equals sign and others in two?

Padding tells the decoder how many bytes were in the final, incomplete group. If your input length divides evenly by 3 there is no padding. If it leaves 2 bytes over you get one equals sign, and if it leaves 1 byte over you get two. This means you can often guess an input length modulo 3 purely from the padding, which is a small but real information leak.

Recommendations

You Might Also Like

Nearby tools from the catalog that fit the same job or workflow.

Cleanor app

Do it all on your device

Cleanor puts these tools in one app: compress and convert images, video, and audio, work with PDFs, and scan text right on your device. Plus free up storage and clear inbox clutter with Email Cleaner. Start with a free trial.

  • iPhone
  • Android
  • Macsoon
  • Windowssoon