Base64 Encode/Decode
Base64 Encode/Decode handles UTF-8 text, Base64URL and MIME-wrapped output, plus image workflows for Data URLs, raw Base64, local preview, and image download.
Input Text
Characters
0 / 50,000
Select or drop an image
Supports PNG, JPEG, WebP, GIF, SVG, BMP, AVIF, TIFF, ICO, HEIC and HEIF when the browser can read them.
Output Text
Output Text
Input Text
Characters
0 / 50,000
MIME type for raw Base64
Raw Base64 does not include MIME information. Choose the original image type first so the preview can be generated automatically.
Paste an image Data URL, or paste raw Base64 and choose a MIME type to preview the image here.
Quick Start
Common Scenarios
URL/JWT
Prefer the URL‑safe variant (−/_); the trailing '=' may be omitted to avoid escaping issues
Email/MIME
When wrapping is required, use MIME 76 columns (CRLF); for the web, don't wrap. This tool provides 76‑column wrapping and an LF/CRLF toggle
Multiline text
enable Per‑line encode to encode each line independently
MIME/PEM
enable 76‑column wrapping; enable LF line breaks when needed
Data URL
When embedding, generate data:[mime];base64,…; the decoder auto‑extracts the part after the comma
Round‑trip verify
encode then immediately decode to ensure fidelity
Image upload
Keep the original bytes and switch between Data URL and raw Base64 output without re-uploading
Image Data URL
paste data:image/...;base64,... to detect the MIME type automatically and preview the image immediately.
Raw Base64 image data
provide the original image MIME type so the tool can preview it automatically and download it as an image.
Encoding Parameters & Variants
Text & Image Boundaries
Usage Advice
Limitations & Compatibility
Privacy & Security
FAQ
Base64 represents bytes as printable text so they can travel through text-oriented systems such as email, JSON, URLs, or configuration files. It is reversible encoding, not encryption. How it works: every 3 bytes are split into four 6-bit values and mapped to the standard alphabet A-Z, a-z, 0-9, +, and /. If the source length does not divide evenly, '=' padding aligns the output. The encoded text is usually about 33% larger than the original bytes. Standard Base64 vs Base64URL: standard Base64 keeps +, /, and padding. Base64URL uses - and _ instead, and padding is often omitted. This tool defaults to standard Base64. Turn on URL-safe output for URLs, cookies, and JWT-style payloads; keep it off for legacy or MIME systems that expect +/ and '='. Example: text 'hello' encodes as 'aGVsbG8=' in standard Base64. With URL-safe output enabled, this page omits padding and returns 'aGVsbG8'. Data URL: image embedding usually uses data:[mime];base64,.... When decoding, this tool extracts the payload after the comma automatically. Security note: Base64 does not provide secrecy, integrity, or malware scanning. Encrypt or validate sensitive content before encoding.
No. Base64 is reversible encoding, so anyone can decode it. Encrypt the content first if it needs to stay confidential.
The input usually contains characters outside Base64/Base64URL, or its length cannot be padded safely (length % 4 = 1). Decode removes whitespace, accepts -/_ variants, extracts Data URL payloads, and adds padding when possible.
Differences usually come from line wrapping, whether '=' padding is kept, URL-safe variants (-/_), or mismatched text encodings. When comparing results, make sure both sides use the same text encoding, disable automatic wrapping, and confirm whether URL-safe mode and padding are used.
Base64 represents 3 bytes with 4 text characters, so roughly 33% overhead is normal. A Data URL prefix, line wrapping, or padding can make the final text longer.
Yes. Emoji and multilingual text are handled as UTF-8 in Text mode. If the decoded result is actually non-text binary data, seeing garbled output is expected.