Base64 Encoder and Decoder
Encode text to Base64 or decode Base64 back to text, with proper UTF-8 handling so Hindi, accented letters and emoji survive the round trip. Tick URL-safe for tokens and URLs, or choose a file to turn it into a data URI for CSS or HTML. Files are read locally and never leave your device.
Base64 Encoder and Decoder
Uses - and _ instead of + and /, without = padding. Decoding accepts both forms.
The file is read in your browser and never uploaded. Up to 10 MB.
Runs in your browser. Nothing you enter is uploaded or saved.
How to use this tool
- Enter text or Base64. Type the text to encode, or paste the Base64 string to decode.
- Choose URL-safe if needed. Tick URL-safe for output used in URLs, file names or JWT-style tokens.
- Encode or decode. Press the button and copy the result.
- Convert a file (optional). Choose a small file such as an icon to get a data URI you can paste into CSS or HTML.
What Base64 is for
Base64 represents binary data using 64 safe ASCII characters, so it can travel through systems built for text, such as email, JSON and URLs. Encoded data is about 33% larger than the original.
Base64 is not encryption
Anyone can decode Base64 instantly. Never use it to hide passwords, API keys or personal data; use proper encryption or hashing instead.
Standard versus URL-safe
Standard Base64 uses + and / with = padding. Base64URL (RFC 4648) swaps them for - and _ and usually drops the padding, so the result is safe in URLs and file names.
When to use data URIs
Inlining a tiny icon as a data URI saves a request, but larger files bloat your HTML or CSS and cannot be cached separately. Keep data URIs for very small assets.
Frequently asked questions
Why does decoding say the result is not valid UTF-8?
The Base64 probably contains binary data such as an image or a compressed file, which cannot be shown as text.
Why do some Base64 strings end in = or ==?
The equals signs are padding so the length is a multiple of four. The decoder adds missing padding automatically.
Is there a size limit?
Files are limited to 10 MB here to keep the browser responsive. Large data URIs are rarely a good idea anyway.