What Base64 is for
Base64 represents binary data using 64 printable characters (A–Z, a–z, 0–9, + and /, with = padding). It lets images, files, keys and other bytes travel through systems that only handle text: JSON payloads, XML, email (MIME), HTML data URIs and HTTP headers such as Basic authentication. The cost is size: Base64 output is about 33% larger than the original data. These Base64 tools cover the conversions developers need most.
Choose the right Base64 tool
- Text – Base64 encode and Base64 decode work with UTF-8 text, so accented characters and emoji survive the round trip.
- Images – image to Base64 creates data URIs for HTML and CSS, and Base64 to image previews and downloads an encoded image.
- Any file – file to Base64 encodes PDFs, fonts, audio and other binaries.
- Structured data – Base64 to JSON decodes and formats encoded payloads; JSON, XML, YAML and CSV encoders go the other way.
- Bytes – Base64 to hex and hex to Base64 switch between the two common representations of keys and hashes.
Data URIs: when to inline images
A data URI such as data:image/png;base64,iVBORw0… embeds an image directly in HTML or CSS. That saves an HTTP request, which is useful for tiny icons, email templates and single-file documents. For larger images it is counterproductive: the encoded image is a third bigger, cannot be cached separately and delays rendering of the page that contains it. As a rule of thumb, inline only images of a few kilobytes.
Base64 variants
- Standard (RFC 4648) uses
+and/. - URL-safe (Base64URL) uses
-and_instead and often omits padding; JWTs use it. - MIME wraps lines at 76 characters for email.
If a decoder rejects your input, check for URL-safe characters, missing padding or line breaks, which are the usual causes.
Where you will meet Base64
Base64 appears in HTTP Basic authentication headers, email attachments, embedded fonts in CSS, SSH and TLS keys in PEM files, JSON Web Tokens, Kubernetes secrets and many APIs that accept file uploads inside JSON. Decoding such a value is often the fastest way to see what a system really sent.
A reminder about security
Base64 is an encoding, not encryption. Anyone can decode it, so a Base64-encoded password or API key is not protected. Use proper encryption or a secret manager for sensitive values. All Base64 tools here run in your browser, so the files you encode are not uploaded.
Related tools live in the URL encoding and hash categories.