Base64 Encode and Decode Online – Text and Files
Encode text to Base64 or decode Base64 back to text — with emoji and accents handled correctly. Decode Base64 files such as PDFs and images, or turn a file into a data URL.
Choose “Decode”, paste the Base64 string and read the text — or, if it contains a file such as a PDF or PNG, click the download button. Choose “Encode” to turn text into Base64, with an optional URL-safe variant that uses - and _ instead of + and /.
How to use Base64 Encode / Decode
- Choose “Encode” or “Decode”.
- Paste your text or Base64 string. Data URLs (data:…;base64,) are accepted too.
- For URLs and file names, tick “URL-safe”.
- If the decoded data is a file, the tool recognises PDF, PNG, JPG, GIF, WebP, SVG and ZIP and offers a download.
- To encode a file, click “File → Base64” and copy the data URL.
What is Base64?
Base64 turns any data — text, images, PDFs — into plain text made of 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so encoded data is about 33 % larger. The = signs at the end are padding. Base64 is used wherever binary data must travel through systems built for text: email attachments (MIME), data URLs in HTML and CSS, JSON APIs, JWT tokens and HTTP Basic authentication.
Base64 is not encryption
Anyone can decode Base64 in a second — it only changes the representation, not the secrecy. Never use it to hide passwords or personal data. For secrets, use real encryption.
UTF-8 done right
The browser’s built-in btoa() fails on characters outside Latin-1, such as emoji, Chinese or many accented letters. This tool first converts text to UTF-8 bytes and then encodes them, so “Olá 👋” survives the round trip exactly.
Standard vs URL-safe Base64
| Variant | Characters 62 and 63 | Padding | Used in |
|---|---|---|---|
| Standard (RFC 4648) | + and / | = | email, data URLs, most APIs |
| URL-safe (base64url) | - and _ | usually removed | URLs, file names, JWT |
The decoder accepts both variants automatically, with or without padding.
Decode Base64 to a file
If you paste the Base64 of a PDF, image or ZIP, the tool checks the first bytes (the “magic number”) to recognise the file type and lets you download it — a quick way to recover an attachment from an API response or an email source. The reverse works too: File → Base64 creates a data URL you can paste into HTML, CSS or JSON.
Common uses
- Embedding small icons or fonts in CSS as data URLs, saving an HTTP request.
- Sending files inside JSON, where raw bytes are not allowed.
- Reading the payload of a JWT token, whose parts are base64url-encoded JSON.
Everything happens in your browser; nothing is uploaded. To inspect JSON after decoding, paste it into the JSON Formatter.
You may also find these free tools useful: JSON Formatter, Password Generator and Regex Tester.
Frequently asked questions
How do I decode Base64?
Choose “Decode” and paste the string. Text appears immediately; if the data is a file such as a PDF or image, a download button appears.
How do I convert Base64 to PDF?
Paste the Base64 (with or without the data: prefix) in Decode mode. The tool recognises the PDF and lets you download it as a .pdf file.
Why is Base64 bigger than the original?
Every 3 bytes are written as 4 characters, so the result is about 33 % larger, plus up to two = padding characters.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / and usually drops the = padding, so the result can be used in URLs and file names.
Is Base64 secure?
No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to protect sensitive data.
Last updated: