FormatterHQ

Base64 Tools

Encode and decode Base64 text, files and images, create data URIs and convert Base64 to and from JSON, XML, CSV, hex and binary.

Base64 Decode Decode Base64 to text online. Handles UTF-8, URL-safe Base64, missing padding and binary data downloads. Base64 Encode Encode text or files to Base64 online. UTF-8 safe, with URL-safe alphabet and MIME line wrapping options. Base64 to ASCII Decode Base64 to ASCII text; bytes outside printable ASCII are shown as \xHH escapes. Base64 to Binary Decode Base64 and show the underlying bytes as binary (8-bit) byte values. Base64 to CSV Decode a Base64 string back to CSV with syntax highlighting. Base64 to Hex Decode Base64 and show the underlying bytes as hexadecimal byte values. Base64 to Image Preview and download images from Base64 strings or data URIs. Detects PNG, JPEG, GIF, WebP, BMP, ICO and SVG. Base64 to JSON Decode a Base64 string back to JSON, validated and pretty-printed. Base64 to Octal Decode Base64 and show the underlying bytes as octal byte values (000–377). Base64 to Text Convert Base64 back into plain readable text with correct UTF-8 decoding. Base64 to TSV Decode a Base64 string back to TSV with syntax highlighting. Base64 to XML Decode a Base64 string back to XML with syntax highlighting. Base64 to YAML Decode a Base64 string back to YAML with syntax highlighting. Basic Auth Header Generator Build an HTTP "Authorization: Basic" header from username:password, or decode an existing Basic auth header back to credentials. Binary to Base64 Convert binary (8-bit) byte values to a Base64 string. Separate the bytes with spaces, commas or line breaks, or paste one continuous bit string. CSV to Base64 Convert CSV to a Base64 string online. UTF-8 safe; paste text or upload a .csv file. File to Base64 Convert any file — PDF, ZIP, font, image or document — to Base64 or a data URI in your browser. Hex to Base64 Convert hexadecimal byte values to a Base64 string. Separators and prefixes are handled automatically. Image to Base64 Convert PNG, JPG, GIF, WebP, SVG or ICO images to Base64 data URIs for HTML, CSS and JSON. JPG to Base64 Convert a JPG/JPEG photo to a Base64 string or data URI, with preview and size information. JSON to Base64 Convert JSON to a Base64 string online. UTF-8 safe, validates the JSON first; paste text or upload a .json file. MP3 to Base64 Convert MP3 audio files to Base64 or a data URI you can play directly in an HTML audio element. Octal to Base64 Convert octal byte values (000–377) to a Base64 string. Separate the values with spaces, commas, semicolons or line breaks. PNG to Base64 Convert a PNG image to a Base64 string or data URI with a live preview. SVG to Base64 Convert SVG markup or an .svg file to a Base64 data URI for CSS backgrounds, img tags and JSON. TSV to Base64 Convert TSV to a Base64 string online. UTF-8 safe; paste text or upload a .tsv file. XML to Base64 Convert XML to a Base64 string online. UTF-8 safe; paste text or upload a .xml file. YAML to Base64 Convert YAML to a Base64 string online. UTF-8 safe; paste text or upload a .yaml file.

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

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.

Frequently asked questions

Why is Base64 output larger than the input?
Base64 encodes every 3 bytes as 4 characters, so the result is about 33% larger than the original data, plus a little padding.
Is Base64 encryption?
No. Base64 is a reversible encoding that anyone can decode without a key. Never rely on it to protect passwords or other secrets.
What is the difference between Base64 and Base64URL?
Base64URL replaces the plus and slash characters with minus and underscore and usually drops the padding, so the result can be used safely in URLs and file names.
Should I embed images as Base64?
Only small ones, such as icons of a few kilobytes. Larger images are better served as separate files that browsers can cache.