Base64 Encoder / Decoder
ConverterEncode text to Base64 or decode Base64 back to plain text with full UTF-8 support. Instant bidirectional conversion with one-click copy for any string.
Related Tools
About Base64 Encoder / Decoder
Base64 encodes arbitrary binary data with 64 printable characters, widely used to carry binary safely inside text protocols such as JSON, HTTP headers, and email. This tool converts text and Base64 in both directions while preserving full UTF-8 (for example Chinese text) without corruption. For instance it encodes hello as aGVsbG8=, or encodes a certificate snippet before embedding it in YAML. Conversion runs locally in your browser and pasted sensitive content is never uploaded.
How to Use
- Open the Base64 Converter tool
- Choose Encode or Decode mode
- Paste text or upload a file in the input area
- Click the Convert button, results appear in real-time
- Copy the converted result
Use Cases
- Inline images via Data URI — Embed small images as Base64 directly in CSS or HTML to eliminate extra HTTP requests.
- Binary in API payloads — JSON has no binary type, so files and crypto results are commonly transmitted as Base64 strings.
- Debug JWTs — JWTs are three Base64URL segments — decode them individually to inspect header and payload.
- Email attachments — SMTP requires attachments to be Base64-encoded for transport over text-based email.
- Config-file secrets — Certificates and keys are often stored as Base64 in YAML or JSON configuration files.
- Binary data debugging — Decode Base64 strings from API responses to inspect the raw binary content they actually contain.
- JWT segment decoding — Decode each Base64URL segment of a JWT separately to examine the header, payload, and signature sections.
FAQ
Is Base64 encryption?
No. Base64 is encoding — anyone can decode it instantly. For confidentiality, use AES (see our AES Encryption tool).
Why does encoded data get larger?
Base64 uses 4 characters to represent 3 bytes, an ~33% size increase — the cost of squeezing arbitrary binary into a text channel.
What's the difference between Base64 and Base64URL?
Base64URL replaces + and / with - and _, and drops the = padding, making it safe in URLs and filenames. JWTs use Base64URL.
Why does decoding fail?
Common causes: (1) non-Base64 characters like newlines or spaces; (2) missing = padding; (3) URL-safe variant not converted back to + and /.
Can I encode images?
Yes — read the image as a binary Blob/ArrayBuffer first, then encode. Or use our File to Base64 tool to drag-and-drop directly.
Why do I get garbled output when decoding?
Three common causes. First, the source string is not UTF-8 text but true binary (an image, archive, or crypto result), so decoding it naturally yields mojibake — verify the actual content type first. Second, the input isn't strictly standard Base64: it may contain stray newlines/spaces, or a URL encoder already turned + into space or escaped /, so strip non-Base64 characters before decoding. Third, the decoded text uses a differently-encoded charset than you expected. Debug in order: decide whether the payload is really meant to travel binary through a text channel, clean the input, then decode as Unicode.
Does a line break inside Base64 affect decoding?
Yes. Some encoders and mail protocols insert CR/LF every 76 characters (per RFC 4648's recommended line width), and strict decoders either error out or produce corrupt output when they meet those newlines or spaces. If you pasted Base64 that contains line breaks, remove all ASCII whitespace (\n, \r, space) first, then decode. Most modern languages also reject whitespace in strict mode, so you must clean it with replacement or a regex first. A safe pattern is to filter with [^A-Za-z0-9+/=] before handing the string to the decoder.