Encode and decode Base64 in seconds
Base64 turns binary data into plain text, which is why it turns up everywhere in development: images embedded in CSS and HTML, attachments in email (MIME), API payloads, configuration files, Kubernetes secrets, basic auth headers and JSON Web Tokens. This Base64 encode/decode tool handles text and files, standard and URL-safe.
Modes
Encode text → Base64. Type or paste text and get its Base64 encoding. Text is encoded as UTF-8, so accented letters, emoji and non-Latin scripts round-trip correctly – unlike the browser’s basic btoa(), which fails on them.
Decode Base64 → text. Paste Base64 to see the original text. The status confirms “Decoded as UTF-8 text.” If the result isn’t readable text, the tool tells you: it is probably an image or other file, so use Decode to a file to download it with the right type.
Encode a file (image, PDF, font…). Choose any file up to about 20 MB. You get both the raw Base64 and a data URI that includes the MIME type, ready to paste:
<img src="data:image/png;base64,iVBORw0KGgo..." alt="Logo">
@font-face { src: url(data:font/woff2;base64,d09GMgAB...) format('woff2'); }
Use Copy data URI or Copy Base64 only, depending on what the destination expects.
URL-safe Base64
Standard Base64 uses +, / and = padding, which have special meanings in URLs. Tick URL-safe (- and _ instead of + and /, no padding) to produce Base64url, as used by JWTs, OAuth tokens and many APIs. When decoding, the tool accepts both variants.
When to use data URIs – and when not to
Embedding small assets (icons, tiny images, a single font) saves a network request. But Base64 makes data about 33% larger, and embedded files can’t be cached separately. For anything more than a few kilobytes, a normal file is usually faster. For images on websites, compress them first with Compress Image, or use SVG icons.
Decoding JWTs
A JSON Web Token has three URL-safe Base64 parts separated by dots. Paste the middle part (the payload) into decode mode to read its claims. Remember that decoding does not verify the signature – never trust a token’s contents just because you can read them.
Base64 is not security
Base64 offers no protection. Credentials in a Base64 “basic auth” header or a Kubernetes secret are readable by anyone who sees them. Use proper encryption – for documents, for instance, Protect PDF with AES-256.
Troubleshooting
- “Not valid Base64” – check for missing characters at the end, or stray quotes, spaces or line prefixes from copying.
- Garbled text – the data is binary; use Decode to a file.
- File too large – the tool asks you to use a file under 20 MB, because larger files make the browser slow and are rarely suitable for embedding.
Related tools
Convert data between formats with CSV to JSON and XML to JSON, or generate a favicon pack instead of embedding icons with Favicon Generator.
Privacy
Everything runs locally in your browser – useful when the data you are decoding contains tokens or personal information.
Frequently asked questions
What is Base64?
Base64 represents binary data using 64 safe text characters (A–Z, a–z, 0–9, + and /). It lets images, files and arbitrary bytes travel through text-only systems like JSON, email and HTML.
Is Base64 encryption?
No. Base64 is an encoding, not encryption – anyone can decode it. Never use it to hide passwords or secrets.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / and drops the = padding, so the result can be used in URLs, file names and JSON Web Tokens without escaping.
What is a data URI?
A data URI like data:image/png;base64,... embeds a file directly in HTML or CSS, for example as an img src or a CSS background, without a separate file.
Why does decoding show an error?
Not valid Base64 means the input contains characters outside the Base64 alphabet or is truncated. If the text decodes but is not readable, it is probably a file – use Decode to a file.
Is my data uploaded?
No. Encoding and decoding happen in your browser.