What is Base64 and why teams still rely on it
Base64 is a binary-to-text encoding defined in RFC 4648. It maps every three bytes of input to four ASCII characters from a 64-character alphabet, typically A–Z a–z 0–9 + / with = padding at the end when the byte length is not a multiple of three. The result is safe to embed in JSON strings, XML, headers, and URLs (with escaping or a URL-safe alphabet). It does not encrypt data—anyone can reverse it—so treat it as a transport representation, not a secret vault.
Product and platform engineers encounter Base64 when APIs return thumbnails, PDFs, or signatures as string fields; when DevOps stores kubeconfigs or certificates in environment variables; and when front-end developers inline tiny SVG or PNG assets as data URIs for prototypes. For structured API bodies that mix Base64 with JSON, validate and pretty-print with our JSON formatter & validator after you paste samples from logs.
How to use this Base64 tool (step by step)
- Encode: Paste UTF-8 text (including emoji and non-Latin scripts) into the box, optionally check URL-safe Base64 if your consumer expects
- _instead of+ /, then click Encode UTF-8 → Base64. Enable line wrapping when you want readable 76-character rows for docs or PEM-style display. - Decode: Paste Base64 (with or without line breaks). The tool strips
data:...;base64,prefixes, ignores whitespace, accepts URL-safe alphabets, and restores padding when possible. Click Decode Base64 → UTF-8. If the payload is not valid UTF-8 text, you may see replacement characters—use a hex or file workflow for raw binary inspection. - Encode a file: Use Encode file to read a local file and output its Base64 without uploading it. Combine with URL-safe mode when you build tokens or filenames.
- Copy sends the current editor contents to the clipboard for curl, Postman, Terraform variables, or tickets. Use Load sample text to try encoding quickly.
UTF-8 vs raw btoa — keywords that explain the difference
Searchers often look for Base64 encode Unicode or btoa UTF-8 because the browser's btoa only accepts code units in the Latin-1 range. Real-world APIs almost always mean "encode the UTF-8 bytes of this string." This page follows that convention so internationalized text and symbols encode the same way server-side libraries do in Node, Go, and Python.
Standard Base64 vs Base64URL in JWTs and APIs
JSON Web Tokens use Base64URL for the header and payload segments: no padding =, and +/ replaced by -_. Toggle URL-safe mode here when you want matching output for tests or documentation. To inspect decoded JSON inside a token without verifying signatures, open the JWT decoder. For checksums and fingerprints of decoded bytes, use the hash generator.
Data URIs, HTML, and performance-minded embedding
A data URI combines a MIME type with inline Base64, for example data:image/svg+xml;base64,.... They are convenient for prototypes and email templates but can bloat HTML and hurt caching for large assets on public sites—prefer URLs and CDNs for production media. When you work on page markup alongside assets, the HTML formatter helps keep templates readable.
Security, privacy, and compliance notes
Because encoding is reversible, never treat Base64 as protection for personal data in logs or URLs. Prefer redaction and access controls. This tool keeps processing client-side, which helps when you handle credentials or pre-production payloads you do not want on a shared service. For public URL safety and crawler behavior, review headers and redirects with our HTTP header checker and redirect chain checker when debugging links that carry encoded parameters.
Related developer tools
Explore the full code and developer tools catalog. Highlights:
- JSON Formatter & Validator — Format, validate, minify, and explore JSON in a collapsible tree—fix payloads before they hit production.
- JSON to CSV Converter — Turn JSON arrays into downloadable CSV with automatic column detection for spreadsheets and BI tools.
- JSON to YAML Converter — Convert JSON to readable YAML for configs and Kubernetes—copy or download the result.
- CSV to JSON Converter — Paste or upload CSV and get structured JSON with header-aware typing for APIs and apps.
- YAML to JSON Converter — Parse YAML to valid JSON with clear errors—ideal for CI configs and cloud templates.
- XML Formatter & Validator — Beautify and validate XML with structure insight and actionable parse errors.
- Regex Tester & Debugger — Test patterns live with highlights, capture groups, and flags—debug regex without leaving the browser.
- SQL Formatter — Pretty-print SQL with indentation and keyword casing for readable queries and code review.
- HTML Formatter & Minifier — Beautify or minify HTML and compare raw markup with a quick rendered preview.
- CSS Formatter & Minifier — Format messy stylesheets or minify CSS for faster loads—keep design tokens consistent.
- JavaScript Formatter & Minifier — Pretty-print or minify JavaScript for debugging locally and shipping smaller bundles.
- HTML to Markdown Converter — Convert HTML snippets to Markdown for docs, CMS migrations, and README cleanup.
- Markdown to HTML Converter — Turn Markdown into HTML with a live preview—handy for emails, blogs, and static pages.
- Code Diff Checker — Compare two code blocks side by side with clear add/remove highlighting for reviews.