Base64 encoder

Turn text or files into Base64 text instantly.

Runs in your browser. Your files never leave your device.

How to encode Base64

  1. Paste text, or switch to file mode and drop a file.
  2. Turn on URL-safe if you need the result in a link or filename.
  3. Copy the result or download it as a text file.

How Base64 encoding works

RFC 4648 defines the Base64 alphabet: the 64 characters A-Z, a-z, 0-9, + and /, plus = as padding at the end.

Every 3 input bytes become 4 output characters, since 3 bytes is 24 bits and each Base64 character holds 6 bits. When the input length is not a multiple of 3, one or two = signs pad the last group.

Text vs URL-safe alphabets

PositionStandard (RFC 4648)URL-safe (RFC 4648 §5)
62nd character+-
63rd character/_
Padding= at the endusually dropped

URL-safe Base64 avoids characters that need escaping in a URL or filename, such as / being mistaken for a path separator.

Where Base64 shows up

  • Data URLs, so an image or font can be embedded directly inside CSS or HTML instead of a separate file.
  • Email attachments, since MIME (RFC 2045) only allows plain text in a message body.
  • JSON Web Tokens and many API payloads, since JSON has no way to hold raw binary data.
  • Basic HTTP authentication headers, which send a username and password as one Base64 string.

Base64 encode FAQ

What is Base64 encoding?

Base64 turns any bytes into plain text using 64 safe characters (A-Z, a-z, 0-9, + and /), so binary data can travel through text-only systems like email and JSON.

How much bigger does the output get?

Base64 text is about 33 percent larger than the original bytes, since every 3 bytes become 4 characters.

What does URL-safe mean?

It replaces + and / with - and _ and drops the trailing = padding, so the result can be used directly in a URL or filename without escaping.

Is my file uploaded anywhere?

No. Encoding happens in your browser, so your file and text never leave your device.

Why does Base64 only use 64 characters?

Base64 groups bits 6 at a time, and 2 to the 6th power is 64, so every possible 6-bit value maps to one letter, digit, + or /. That set is safe to put inside plain text formats like JSON, XML and email.

Can I encode a very large file?

Yes, but Base64 text takes about a third more memory than the original file, and very large results can be slow to copy or download in some browsers. It works well for files up to tens of megabytes.

Related tools