Base64 Encoder and Decoder
Encode text or files to Base64 and decode Base64 back to text or a file, with UTF-8, URL-safe and data URL options.
How to encode and decode Base64
- To encode text, choose Encode and type or paste it. The Base64 appears as you type, using UTF-8 so accents, Urdu, Arabic, Chinese and emoji all work.
- To encode a file, such as an image for HTML or CSS, press Encode a file. Turn on the data: URL prefix if you will paste it into a web page.
- To decode, choose Decode and paste the Base64 or data: URL. Spaces, line breaks, missing padding and URL-safe characters are all accepted.
- If the result is text you will see it straight away; if it is an image, PDF or other file, you can preview it and download it.
Example
| Text | Base64 |
|---|---|
| Hello | SGVsbG8= |
| Hello, world! | SGVsbG8sIHdvcmxkIQ== |
| café | Y2Fmw6k= |
| ✓ | 4pyT |
The = signs at the end are padding: they show the last group held one or two bytes instead of three.
Frequently asked questions
What is Base64?
Base64 writes any data, including images and files, using only 64 safe characters: A–Z, a–z, 0–9, + and /. It lets binary data travel through places that only accept text, such as email, JSON, HTML and URLs. It is an encoding, not encryption: anyone can decode it.
Why is the Base64 bigger than the original?
Every 3 bytes become 4 characters, so Base64 is about 33% larger than the data it holds, plus line breaks if you wrap it. A 300 KB image becomes about 400 KB of text.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in web addresses, and = for padding. URL-safe Base64 (Base64url) uses - and _ instead and drops the padding. It is used in JSON Web Tokens (JWT) and links. The decoder accepts both kinds.
How do I turn Base64 into an image or PDF?
Choose Decode and paste the Base64 or a data: URL. The converter recognises PNG, JPG, GIF, WebP, PDF, ZIP, MP3 and other files from their first bytes, shows images, and offers the file to download with the right extension.
How do I put an image in HTML or CSS with Base64?
Encode the image with "Add the data: URL prefix" on, then use the result as the address: <img src="data:image/png;base64,…"> or background-image: url("data:image/png;base64,…"). This is best for small icons; large images load faster as normal files.
Is it safe to paste private data here?
Yes. Encoding and decoding happen in your browser, and nothing you type or open is sent anywhere. Remember that Base64 hides nothing, so do not use it to protect passwords or secrets.
Related tools
Browse all tools- Image Converter Convert images between JPG, PNG, WebP, AVIF and ICO, resize them, and download one by one or as a ZIP. Nothing is uploaded.
- CSV to JSON Converter Turn CSV into JSON, or JSON into CSV, with delimiter detection, headers, number types and nested objects flattened. Paste or open a file.
- Number Base Converter Convert numbers between binary, octal, decimal and hexadecimal (or any base from 2 to 36), and text to binary or hex.
- Color Converter Convert colours between HEX, RGB, HSL, HWB, CMYK and OKLCH, pick from the screen, and check contrast for readable text.