Skip to main content

Base64 Encoder & Decoder

Encode and decode Base64 instantly — text, images, and files with live preview, JWT decoder, code snippets for 7 languages, and 4 Base64 variants. Free, fast, and 100% browser-based — your data never leaves your machine.

Encode Decode
0 chars
Image → Base64 Base64 → Image
📷
Drag & drop an image here, or click to upload
PNG, JPG, GIF, SVG, WebP, ICO, BMP — up to 10 MB
Image preview
File → Base64 Base64 → File
📄
Drag & drop any file here, or click to upload
PDF, ZIP, fonts, audio, video — any file up to 10 MB

Ctrl + Enter to run

Your data never leaves your browser

How to Use the Base64 Encoder & Decoder

  1. Choose your mode — Select Text for strings and JWT tokens, Image for pictures with live preview and 5 output formats, or File for any binary file (PDF, ZIP, fonts, etc.).
  2. Set the direction — Toggle the switch to choose Encode (original → Base64) or Decode (Base64 → original). The tool auto-detects JWT tokens and shows a decoded panel.
  3. Enter your data — Paste text, drag-drop an image, or upload a file. Optionally select a Base64 variant (Standard, URL-safe, MIME, PEM) and charset.
  4. Copy, download, or get code — Click "Copy" for clipboard, "Download" to save, or use the code snippet tabs to get ready-to-use code for JavaScript, Python, PHP, Java, Go, cURL, or CSS.

About Our Free Base64 Encoder & Decoder

Base64 is the universal encoding used to embed binary data in text-based systems — from email attachments and data URIs to JWT tokens and API payloads. But most online Base64 tools are cluttered with ads, limited to text-only, or send your data to a server.

Our Base64 tool is a best-in-class, free online encoder and decoder that handles text, images, and files in one interface — with features that no single competitor offers:

  • 3 modes in one tool — Text, Image, and File. No need to open separate tools for different data types.
  • Bi-directional — Encode and decode with a single toggle switch. 70-75% of users need both directions.
  • Image preview with 5 output formats — See your image rendered from Base64, then copy as raw Base64, Data URI, CSS background-image, HTML <img> tag, or JSON string.
  • JWT auto-decoder — Paste a JWT token and see the header, payload, and signature decoded with expiry status. No other Base64 tool does this.
  • Code snippets for 7 languages — One-click copy for JavaScript, Python, PHP, Java, Go, cURL, and CSS. Stop manually wrapping your Base64 output.
  • 4 Base64 variants — Standard (RFC 4648), URL-safe (Base64URL), MIME (76-char lines), and PEM (64-char lines). Full control over output format.
  • Auto-detection — The tool detects whether input is plain text, Base64, JWT, or a data URI and routes accordingly.

100% browser-based — your data is never uploaded to any server. All processing uses the browser’s built-in btoa/atob and FileReader APIs. No file size limits (up to 10 MB), no signup, no privacy concerns. Safe for API tokens, configuration secrets, and proprietary data.

Why Choose Our Base64 Tool Over Others?

  • Privacy-first — 87% of competitor tools send your data to a server. Ours runs 100% in your browser. Your API keys, tokens, and sensitive data never leave your machine.
  • No ads, no signup, no limits — The #1 and #2 complaints about competitor tools, eliminated. Clean, distraction-free interface.
  • Image-to-Base64 with preview — Most tools show raw Base64 text. Ours renders the image, shows dimensions and file size, and generates 5 output formats including CSS and HTML snippets.
  • JWT decoder built-in — Paste a JWT and see header, payload, and signature decoded in color-coded panels with expiration status. Developers search for this constantly.
  • 7-language code snippets — Copy ready-to-use code for your language instead of manually wrapping Base64 strings.
  • All file types supported — Not just text and images. Encode PDFs, ZIPs, fonts, audio, video — any binary file up to 10 MB.
  • Draft persistence — Your last text input is saved in localStorage and restored automatically. Never lose work across sessions.

Common Base64 Use Cases

  • Embedding images in CSS/HTML — Convert small icons and logos to Base64 data URIs to eliminate HTTP requests and improve page load speed.
  • Decoding JWT tokens — Inspect JWT payloads from OAuth flows, API authentication, and SSO systems without installing a separate tool.
  • Email attachments — MIME email uses Base64 to encode binary attachments. Decode them to inspect content or encode files for raw email composition.
  • API payloads — Many APIs accept or return Base64-encoded binary data (images, PDFs, certificates). Encode before sending, decode after receiving.
  • Data URIs in web development — Embed fonts, SVGs, and small assets directly in CSS or HTML using data: URIs with Base64 encoding.
  • Configuration and secrets — Kubernetes secrets, Docker configs, and CI/CD variables often use Base64 encoding. Decode to inspect, encode to set.
  • Certificate handling — PEM-encoded certificates and keys use Base64. Decode to inspect certificate contents or convert between formats.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding that represents binary data using 64 ASCII characters (A–Z, a–z, 0–9, +, /). It’s used to safely transmit binary data through text-based systems like email, JSON, HTML, and URLs. Every 3 bytes of input become 4 Base64 characters, making the output about 33% larger.
How do I encode text to Base64?
Paste your text in the input area, ensure the direction is set to "Encode", and click the Encode button (or press Ctrl+Enter). The Base64 output appears instantly. Copy it, download it, or use the code snippet tabs to get ready-to-use code for JavaScript, Python, PHP, Java, Go, cURL, or CSS.
How do I convert an image to Base64?
Switch to Image mode, then drag-drop your image or click to upload. The tool encodes it and shows a live preview. Choose your output format: raw Base64, Data URI, CSS background-image, HTML <img> tag, or JSON string. Supports PNG, JPG, GIF, SVG, WebP, ICO, and BMP.
Is Base64 the same as encryption?
No. Base64 is an encoding, not encryption. It transforms data into a different representation but provides zero security — anyone can decode it instantly. Never use Base64 to protect passwords, API keys, or sensitive data. For security, use proper encryption like AES, RSA, or TLS.
Why is Base64 output larger than the input?
Base64 encodes every 3 bytes into 4 characters, resulting in ~33% size increase. A 100 KB image becomes ~133 KB in Base64. This overhead is the trade-off for safely embedding binary data in text formats. For production use, consider whether the eliminated HTTP request outweighs the size increase (usually yes for files under 10 KB).
What is Base64URL and when should I use it?
Base64URL (RFC 4648 §5) replaces + with - and / with _ to make output safe for URLs and filenames. Use it when encoding data for URLs, query parameters, JWT tokens, OAuth flows, or anywhere the characters + and / would need escaping.
How do I decode a JWT token?
Paste your JWT in Text mode. The tool auto-detects it and shows a color-coded panel with the decoded header (algorithm, type), payload (claims, user data, roles), and signature. It also checks the exp claim and shows whether the token is valid or expired.
Can I encode any file type?
Yes. Switch to File mode and upload any file — PDF, ZIP, fonts, audio, video, or any binary format. The tool reads it in your browser using the FileReader API and outputs Base64. You can also decode Base64 back to a downloadable file with auto-detected MIME type. Maximum file size is 10 MB.
Is my data safe? Does it get sent to a server?
Completely safe. All processing happens 100% in your browser using JavaScript’s built-in btoa/atob and FileReader APIs. Your data is never uploaded, logged, or stored anywhere. Safe for API tokens, certificates, configuration secrets, and proprietary business data.
What is the maximum file size?
The tool handles files up to 10 MB. Base64 output is ~33% larger, so a 10 MB file produces ~13.3 MB of text. A warning appears at 2 MB. For very large files, use command-line tools: base64 on Linux/Mac or certutil -encode on Windows.

Need a Blazing-Fast, SEO-Optimized Website?

Our development team builds performance-first websites that score 90+ on Lighthouse, rank on Google, and convert visitors into customers.

Talk to an Expert