🔐 Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text. Supports URL-safe mode, UTF-8, and custom line-break lengths.
Encoded Base64 appears here
Paste input on the left · 100% private · No server callsAbout Base64 Encoder / Decoder
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). Every 3 bytes of input become 4 Base64 characters, so the output is roughly 33% larger than the original. It is the standard encoding used for embedding images in HTML and CSS via data URIs, attaching files in MIME email, encoding credentials in HTTP Basic Auth headers, and representing binary payloads in JSON APIs.
This tool supports standard Base64 (RFC 4648) and URL-safe Base64 (RFC 4648 §5), which replaces+ with - and / with _ to produce output safe for use in URLs and filenames. All conversion runs entirely in your browser — no data is ever sent to a server.
How to encode or decode Base64
- Select Encode or Decode mode from the toggle at the top.
- Paste your text or Base64 string into the input area.
- The result appears instantly in the output area (Auto Convert is on by default).
- Enable URL-safe mode if the output will be used in a URL, filename, or JWT token.
- Set a Line Break length (64 or 76) when producing PEM certificates or MIME parts that require fixed-width lines.
- Use the ⇄ Swap button to flip input and output and switch mode — handy for round-trip verification.
- Click Copy to copy the result to your clipboard.
Features
🔒 Encode
Converts plain text or binary data into a Base64 string. UTF-8 characters including emoji and CJK are fully supported.
🔓 Decode
Converts a Base64 string back to its original text. Automatically validates the input and handles missing or extra padding.
🌐 URL-Safe
Replaces + with - and / with _ and strips = padding. Safe for URLs, filenames, JWT tokens, and query parameters.
📏 Line Break
PEM certificates use 64-char lines; MIME email uses 76-char lines. Choose the wrap length that matches your target format.
⇄ Swap
Instantly flip input and output and switch mode — great for quickly validating a round-trip encode/decode.
⚡ Auto Convert
Converts as you type with a short debounce. Disable it for very large payloads and click Convert manually instead.
Frequently Asked Questions
Is Base64 encoding the same as encryption?
No. Base64 is an encoding scheme, not an encryption or hashing algorithm. It converts binary data to a text-safe representation — anyone who sees the Base64 string can decode it instantly with no key. Never use Base64 alone to protect sensitive data. Use proper encryption (AES, RSA) when security is required.
Why does my decoded output look like gibberish?
The original data was likely binary (an image, PDF, or archive), not plain text. Base64 is commonly used to embed binary files inside text formats like JSON or XML. Decoding such a string with a text decoder will produce garbled output because the bytes do not represent valid text characters.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / as its 62nd and 63rd characters, and = for padding. These have special meaning in URLs, so URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, and omits = padding. JWT tokens, OAuth 2.0 codes, and many modern web APIs use URL-safe Base64.
Why is Base64 output longer than the input?
Base64 encodes every 3 bytes as 4 characters — a 4:3 ratio — meaning output is about 33% larger than the input. Padding characters (=) round the output length up to a multiple of 4. This overhead is the inherent cost of representing binary data using only printable ASCII characters.
What line break length should I use for PEM certificates?
PEM format (used for TLS certificates, SSH keys, and X.509 certificates) requires lines of exactly 64 characters. MIME email attachments use 76 characters per line (RFC 2045). For JSON APIs, data URIs, and JWTs no line breaks are needed.