~/tools/base64

> base64

encode and decode base64 in your browser. unicode-safe (utf-8). no network call, no ads, no tracking.

$ output
(empty)

## overview

base64 encodes binary data as ascii text using 64 printable characters (A-Z, a-z, 0-9, +, /) plus `=` padding. it was originally designed for mime email bodies (rfc 2045) and is now used everywhere: data urls, http basic auth headers, jwt payloads, tls certificates, json transport of binary blobs. this tool encodes utf-8 text to base64 and decodes base64 back to utf-8 text. the work runs client-side in javascript — your input never leaves your browser. base64 expands data by ~33% (every 3 input bytes become 4 output bytes), so it is not compression; it is a reversible ascii-safe wrapper. base64 is not encryption — anyone who can read base64 can decode it.

## how to use

  1. pick a directionchoose encode (text → base64) or decode (base64 → text).
  2. paste or type your inputfor encode, paste any utf-8 text. for decode, paste a base64 string.
  3. read the outputthe encoded or decoded result updates as you type. copy it to clipboard with the copy button.
  4. handle url-safe variantsif your input uses `-` and `_` instead of `+` and `/`, it is base64url. the decoder accepts both.

## examples

$ example 1 — encode utf-8 text
$ in
hello, world
# out
aGVsbG8sIHdvcmxk
$ example 2 — decode back
$ in
aGVsbG8sIHdvcmxk
# out
hello, world
$ example 3 — emoji preserved via utf-8 byte sequence
$ in
👋 hi
# out
8J+RiyBoaQ==

## common mistakes

  • paddinga base64 string without `=` padding may be base64url (stripped padding per rfc 4648) or malformed. this tool pads as needed.
  • line breakssome tools (like openssl) wrap base64 at 64 or 76 chars. strip line breaks before decoding if your decoder rejects them.
  • utf-8 vs bytesthis tool assumes utf-8 input for text encoding. for raw binary (images, pdfs), use a file-based tool — typing binary bytes into a text field does not work.
  • url-unsafe charsstandard base64 uses `+`, `/`, and `=`, which must be percent-encoded in urls. use base64url instead when building urls or jwts.
  • size overheadbase64 expands payload by ~4/3. don't use it as compression, and keep it out of hot paths where bytes matter.

## faq

is base64 encryption?

no. anyone can decode base64 — it has no key. it is just a binary-to-text encoding. to encrypt, use aes, age, or tls.

why does my emoji come out wrong?

check that your input is utf-8. some old tools encode characters as ascii-only and lose non-ascii bytes.

what is the `=` at the end?

padding. base64 encodes in 3-byte groups; when your input length is not a multiple of 3, `=` pads the final group out to 4 characters.

what is base64url?

a url-safe variant defined in rfc 4648: `+` becomes `-`, `/` becomes `_`, and padding is often stripped. used in jwt and http/2 headers.

what is the encoding alphabet?

A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), / (63), = (padding).

can i use this for binary files?

not directly — paste only text. for files, use `base64 < file` on a unix shell or a file upload tool.

does it handle huge strings?

up to a few megabytes is fine. for bigger inputs, use a native tool (`base64` command) which does not have to round-trip through a textarea.

## related tools

  • url codec percent-encode and decode URL components.
  • jwt decoder decode JWT header and payload client-side. no signature verification.

## references

  1. RFC 4648 — base16, base32, base64 encodings
  2. RFC 2045 — mime part one (original base64)
  3. MDN — btoa / atob
ad slot · tool-base64