Base64 Encoder & Decoder
Text and files to Base64 and back — UTF-8 safe, URL-safe, data URIs.
Decoded file
- Type
- —
- Size
- —
- File name
- —
- Dimensions
- —
Hex dump (first 256 bytes)
File
Data URIs always use standard Base64 with padding and no line breaks, so those options are off.
About the Base64 Encoder & Decoder
Convert text to Base64 and back as you type. Text is encoded as UTF-8 by default, so accents, Hindi, emoji and every other script survive the round trip — something the browser's btoa() cannot do. You can switch to the URL-safe alphabet (used by JWTs and many APIs), drop the = padding, or wrap lines for email (MIME) and PEM files.
Decoding is forgiving where it should be and precise where it matters: line breaks, spaces, missing padding, quotes and data: prefixes are handled automatically, and genuinely broken input gets an exact line and column. If the decoded data is a file rather than text, the tool recognises it from its first bytes — PNG, JPEG, GIF, WebP, PDF, ZIP, Office documents, SVG and more — shows a preview for images and lets you download it. The File → Base64 tab turns any file up to 25 MB into Base64 or a ready-to-paste data URI.
How to use it
- Choose Encode or Decode, then type or paste into the box. The result updates instantly.
- Pick options if you need them: text encoding, URL-safe alphabet, padding and line breaks.
- When decoding gives a file (for example an image), check the detected type and press Download file.
- To encode a file, open the File → Base64 tab, choose or drop the file, and pick Base64 or data URI output.
- Use Copy or Download, or Use as input to reverse the conversion.
Examples
café ✓
Y2Fmw6kg4pyT
Bytes FB FF FE (hex)
Standard: +//+ · URL-safe: -__-
The URL-safe alphabet (RFC 4648 §5) swaps + and / for - and _ so the value can sit in a URL or file name without escaping.
Get-Date
RwBlAHQALQBEAGEAdABlAA==
PowerShell expects UTF-16LE text, so choose UTF-16LE as the text encoding.
data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==
Hello, World!
Common uses
- Embedding small images, icons or fonts in HTML, CSS or JSON as data URIs.
- Reading Base64 fields in API responses, webhooks, Kubernetes secrets and configuration files.
- Turning a Base64 attachment or API payload back into the original PDF, image or ZIP file.
- Preparing Basic authentication headers, PowerShell encoded commands and email (MIME) bodies.
- Inspecting PEM certificates and keys: the Base64 body decodes to the binary DER data.
How Base64 works
Base64 (RFC 4648) turns every 3 bytes into 4 characters from a 64-character alphabet: A–Z, a–z, 0–9, + and /. When the data is not a multiple of 3 bytes, the last group is padded with one or two = signs. That is why encoded data is about 33% larger than the original.
Base64 is an encoding, not encryption: anyone can decode it. Never treat a Base64 value as a secret.
Variants you may meet
- Base64url (RFC 4648 §5) uses
-and_instead of+and/. JWTs use it without padding (RFC 7515). - MIME email bodies wrap lines at no more than 76 characters (RFC 2045).
- PEM files (certificates, keys) wrap at 64 characters between
-----BEGIN …-----and-----END …-----lines (RFC 7468). - Data URIs look like
data:image/png;base64,iVBOR…(RFC 2397).
The decoder accepts all of these: it removes line breaks and spaces, accepts either alphabet, does not require padding, and strips data: prefixes and PEM armour for you.
Limitations
- Files up to 25 MB can be encoded, and Base64 text up to about 40 MB decoded. Very large results are shown as a shortened preview; Copy and Download always use the full result.
- File types are recognised from their first bytes. Unusual formats are offered as a generic
.bindownload. - Previews are shown for image formats your browser can display; other files are offered as downloads.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
Why does my text come out garbled in other Base64 tools?
JavaScript's built-in btoa() only handles Latin-1 characters and throws on anything else, and some tools encode text as Latin-1 or UTF-16. This tool uses UTF-8 by default — the encoding used by the web, JSON and almost every API. If you need another encoding, choose it under Text encoding.
Is it safe to decode Base64 that contains passwords or tokens?
Yes. Everything happens in your browser and nothing is sent to a server. Remember that Base64 is not encryption: anyone who has the encoded text can read it.
What does "Invalid character" mean when decoding?
Base64 only contains letters, digits, +, / (or - and _) and =. The message shows the exact line and column of the first character that does not belong — often a stray quote, a % from URL encoding, or a dot from a JWT.
Do I need the "=" padding?
Many decoders, including this one, do not need it, but some strict ones do. JWTs and most URL-safe uses leave it out; email and most file formats keep it. If in doubt, keep padding on.
How do I turn a Base64 string back into an image or PDF?
Choose Decode and paste the string, with or without the data: prefix. The tool detects the file type, previews images and gives you a Download file button with the right extension.