Mini Tools

Base64 Encode & Decode Online

Works locally in your browser โ€” text and files are never uploaded. Output updates as you type.

What is Base64?

Base64 is a binary-to-text encoding that represents any data using 64 safe ASCII characters (Aโ€“Z, aโ€“z, 0โ€“9, +, /). Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger. When the input length is not a multiple of 3, the output is padded with =.

Examples

TextBase64
HelloSGVsbG8=
Hello, world!SGVsbG8sIHdvcmxkIQ==
โœ“ (UTFโ€‘8)4pyT

How to use this Base64 tool

  • Encode: type or paste text โ€” the Base64 output updates as you type.
  • Decode: switch to Decode and paste a Base64 string to get the original text. Whitespace and line breaks are ignored.
  • URL-safe: produces Base64url (- and _ instead of + and /, no padding) for URLs, file names and JWTs.
  • Unicode-safe: encodes text as UTFโ€‘8 so emoji and non-Latin characters work correctly. Keep it on unless you need raw Latinโ€‘1 bytes.

Common uses of Base64

  • Data URIs for embedding small images in HTML/CSS: data:image/png;base64,โ€ฆ
  • HTTP Basic Auth headers: Authorization: Basic dXNlcjpwYXNz
  • Email attachments (MIME) and binary data inside JSON or XML
  • JSON Web Tokens โ€” each part is Base64url-encoded (try the JWT Decoder)

Base64 on the command line

  • Encode: printf 'Hello' | base64
  • Decode: echo 'SGVsbG8=' | base64 --decode
  • JavaScript: btoa() / atob() only handle Latinโ€‘1 โ€” encode Unicode text with TextEncoder first.

Frequently asked questions

Is Base64 encryption?

No. Base64 is a reversible encoding with no key. Anyone can decode it, so never use it to protect secrets.

Why does Base64 output end with = or ==?

The = characters are padding added when the input length is not a multiple of 3 bytes. URL-safe Base64 usually omits them.

Why is Base64 larger than the original?

Each 3 bytes are represented by 4 characters, so the encoded size is about 4/3 of the original (plus padding).

What is the difference between Base64 and Base64url?

Base64url replaces + with - and / with _ and typically drops = padding, so the result is safe in URLs and file names. It is defined in RFC 4648 section 5.

Why do I get an error for emoji or accented characters?

Plain btoa() only supports Latin-1. Enable the Unicode-safe option to encode text as UTF-8 first.

Is my data uploaded?

No. Encoding and decoding happen entirely in your browser.