What is Base64?
Base64 is a binary-to-text encoding that represents data using 64 printable ASCII characters: A–Z, a–z, 0–9, plus + and /, with = used for padding. It works by taking 3 bytes (24 bits) of input at a time and splitting them into four 6-bit groups, each mapped to one Base64 character. Encoding to Base64 makes data safe to store or transmit through text-only systems — for example embedding images in HTML/CSS as data URIs, sending email attachments (MIME), or carrying tokens such as JWTs. Because every 3 bytes become 4 characters, Base64 increases size by about 33%. Importantly, Base64 is an encoding, not encryption: it provides no secrecy and anyone can decode it.
How Base64 works
Base64 processes data in groups of three bytes (24 bits) at a time. Here is exactly how the word Man becomes TWFu:
- Convert each character to its ASCII value:
M = 77,a = 97,n = 110. - Write each value as 8-bit binary and join them into 24 bits:
01001101 01100001 01101110. - Re-group the 24 bits into four 6-bit chunks:
010011 010110 000101 101110. - Read each chunk as a number from 0 to 63:
19, 22, 5, 46. - Map each number to the Base64 alphabet:
19 = T,22 = W,5 = F,46 = u→ TWFu.
If the input length is not a multiple of three, the output is padded with one or two = characters so its length is always a multiple of four.
How to use
- Enter or paste your text in the input box.
- The Base64-encoded result appears instantly in the output.
- Click Copy to use the encoded value.
Examples
| Input | Base64 |
|---|---|
Man | TWFu |
Hello | SGVsbG8= |
foobar | Zm9vYmFy |
Hello, World! | SGVsbG8sIFdvcmxkIQ== |
Options explained
- Character set / encoding — Controls how your text is turned into bytes before encoding (UTF-8 by default; ASCII, ISO-8859 and other charsets are also supported).
- Split into 76-character lines — Inserts a line break every 76 characters, as required by MIME for email (RFC 2045).
- URL-safe (Base64URL) — Replaces + and / with - and _ so the result is safe in URLs, filenames and JWTs.
- Live mode / Auto Update — Encodes instantly as you type, with no need to press a button.
Common uses
- Data URIs — embedding images, fonts or files directly in HTML/CSS (data:image/png;base64,…).
- Email — encoding attachments and non-ASCII content for MIME.
- Tokens — JWTs and API keys are Base64URL-encoded for safe transport.
- APIs — putting binary data inside text formats like JSON or XML.
- HTTP Basic Authentication — the username:password header value is Base64-encoded.