Base64 Encoder / Decoder
Convert text to and from Base64. Supports URL-safe output and optional 76‑char MIME line wrapping.
Base64 encodes binary data as ASCII text.
Enable URL-safe to use -/_ instead of +// and strip padding =.
Turn on MIME wrapping to wrap the output at 76 characters per line (RFC 2045).
Table of Contents
What is Base64?
Base64 is an encoding scheme that represents binary data using 64 ASCII characters. It's not encryption; it's a reversible transformation used to safely transmit data through systems that only accept text.
How it Works
Data is split into 3‑byte chunks (24 bits) and mapped to four 6‑bit indices (0–63), which are
then represented by a fixed alphabet. If the input length isn't a multiple of 3, padding = characters are added.
This tool encodes and decodes using UTF‑8, which ensures Unicode text is handled correctly.
URL-safe Variant
URL‑safe Base64 replaces + with - and / with _. Padding = may be omitted. This prevents reserved URL characters from appearing
in the output.
MIME 76‑character Wrapping
For email and some legacy systems, Base64 is wrapped at 76 characters per line (RFC 2045). Enable "Wrap at 76 chars (MIME)" to format your output accordingly. Wrapping applies only when encoding.
Common Use Cases
- Embedding Assets: Data URIs in HTML/CSS
- Serialization: Transporting binary in JSON
- Tokens: Safe transmission in URLs and headers
- Email: MIME multipart message bodies
Security Considerations
Base64 is not encryption and offers no confidentiality or integrity guarantees. Do not rely on it for security; use proper cryptography. Validate and sanitize decoded data before use.
Frequently Asked Questions
No. It’s an encoding scheme; anyone can decode it. Use cryptography for secrecy.
Padding is optional in URL‑safe contexts and removing it avoids reserved URL characters. When decoding, padding can be restored automatically.
Input may include characters outside the Base64 alphabet, or whitespace in unexpected
places. For URL‑safe, ensure -/_ are used (not +//).
Yes. The tool encodes/decodes using UTF‑8 via TextEncoder/TextDecoder.