Base64 Encoder
Encode and decode Base64 for text and files, with URL-safe mode, data URIs, file type detection and image preview. Fast, private and offline.
What is the Base64 Encoder & Decoder?
This Base64 Encoder and Decoder converts text and files to Base64 and back, entirely in your browser. Text is encoded as UTF-8 first, so accented letters, Cyrillic, Chinese and emoji round-trip correctly — unlike the browser's built-in btoa(), which fails on any character outside Latin-1.
Encoding options cover the variants you meet in practice: standard Base64 (RFC 4648), URL-safe Base64url with or without "=" padding (used by JWTs and many APIs), 76-character line wrapping for MIME e-mail, and ready-to-paste data: URIs for embedding images or fonts in HTML and CSS.
The decoder is forgiving about formatting — it ignores line breaks and spaces, accepts both alphabets, restores missing padding and strips data: URI prefixes — but reports genuinely invalid characters with their exact position instead of silently dropping them. When the decoded bytes are not text, the file type is detected from its signature (PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, MP3, MP4 and more), images are previewed, and you can download the original file.
Frequently asked questions
- What is Base64 encoding?
- Base64 represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). Every 3 bytes become 4 characters, so data can travel safely through systems that only handle text, such as JSON, XML, e-mail or URLs.
- Is Base64 encryption?
- No. Base64 is a reversible encoding with no key and no secrecy — anyone can decode it. Never rely on it to protect passwords or personal data.
- What is the difference between Base64 and Base64url?
- Base64url (RFC 4648 §5) replaces "+" with "-" and "/" with "_" so the result can be used in URLs and file names without escaping, and usually omits the "=" padding. JSON Web Tokens use Base64url.
- How much bigger does Base64 make data?
- About 33%: every 3 input bytes become 4 output characters, plus up to two padding characters. MIME line wrapping adds roughly another 2.6% for line breaks.
- Why does my decoded text look garbled?
- The original data was probably not UTF-8 text — for example a binary file, compressed data or text in a legacy encoding such as Windows-1252. Binary output is shown as a hex dump with a download button instead of being forced into text.
- Should I inline images as data URIs?
- Only small ones such as icons. Inlining saves an HTTP request but makes the file about a third larger and prevents the image from being cached separately, so large images are better served as normal files.
- Is my data uploaded anywhere?
- No. Encoding and decoding run locally in your browser and files are read with the File API; nothing is sent to a server.
Related tools
- Timestamp ConverterConvert Unix epoch timestamps (seconds or milliseconds) to human-readable dates in any time zone, and dates back to timestamps.
- Number Base ConverterConvert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, including arbitrarily large integers.
- JSON ⇄ CSVConvert JSON arrays to CSV and CSV back to JSON with custom delimiters, header detection, nested-field flattening and file download.
- YAML ⇄ JSONConvert YAML to JSON and JSON to YAML instantly with validation and clear error messages. Ideal for Kubernetes, Docker Compose and CI configs.
- CSS Unit ConverterConvert CSS units between px, rem, em, vw, vh and percentages with a configurable root font size and viewport.
- Lorem IpsumGenerate lorem ipsum placeholder text by paragraphs, sentences or words for mockups, wireframes and UI prototypes. Copy as plain text or HTML.