Base64 Encoder
Encode text or binary data to Base64 — standard and URL-safe variants
How to Use the Base64 Encoder
- Paste text or drag-drop a file into the input.
- The Base64-encoded output appears instantly.
- Toggle URL-safe mode to replace + and / with - and _ (safe for URLs and filenames).
- Copy or download the result.
What is Base64?
Base64 is an encoding scheme that converts binary data into ASCII text using 64 printable characters (A-Z, a-z, 0-9, +, /). It is not encryption — it is purely an encoding format.
Common uses
- Email attachments — MIME encoding for binary files in email
- Data URIs — embed images directly in HTML/CSS as base64 strings
- API payloads — safely transmit binary data in JSON
- JWT tokens — the header and payload sections are Base64URL encoded
- Basic Auth — HTTP Basic Authentication encodes credentials as Base64
Note: Base64 increases data size by ~33%. It is not suitable for large files.
What is Base64 Encoding?
Base64 is an encoding scheme that converts binary data into ASCII text using 64 printable characters (A–Z, a–z, 0–9, +, /). It was designed for safely transmitting binary data over systems built to handle text, like email (MIME) and HTTP headers. Encoding increases data size by roughly 33 % but ensures safe transmission across any text-based channel.
Common Uses
- Encoding images or files as data URIs in HTML/CSS (src="data:image/png;base64,…")
- Sending binary data in JSON API payloads
- HTTP Basic Auth header encoding (username:password → Base64)
- Storing binary data in environment variables or config files
- JWT token payloads are Base64URL-encoded
Frequently Asked Questions
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly — it provides no security. Use AES or RSA for actual encryption.
What is the difference between standard Base64 and URL-safe Base64?
Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ so the output can be safely used in URLs and filenames without percent-encoding.
Why does my Base64 string end with = or ==?
The = characters are padding. Base64 encodes 3 bytes at a time into 4 characters. If the input length isn't divisible by 3, padding is added to make the output a multiple of 4 characters.
Notes from this implementation
Encoding, counted in bytes
Base64 maps every 3 bytes to 4 characters from A–Z, a–z, 0–9, +, and /. Padding with = fills a final group that was short. The text box is read as UTF-8, so é is two bytes and will not match a tutorial that encoded Latin-1.
Vector
hello aGVsbG8=
URL-safe Base64, used in JWT segments, replaces + with - and / with _, and often drops the padding. This page’s standard encoder will not match a JWT segment until you apply that alphabet. The JWT decoder does that for you. Do not “encrypt” a password by Base64-encoding it; anyone can reverse the alphabet.