🔣 Base64 Encoder & Decoder

Encode text or files to Base64, or decode Base64 back to text or binary. UTF-8 safe. Runs entirely in your browser.

Input 0 chars
Output
📁

Drop a file here or click to browse

Any file type — text, images, PDFs, archives, anything

Max 10 MB · runs entirely in your browser · no upload
📄
Copied to clipboard

About Base64 Encoder

Base64 Encoder is a free browser-based tool for converting text or files to Base64 and back. Paste some text, drop in a file, hit Encode or Decode — done. Everything runs entirely in your browser, so your data never leaves your device.

Base64 is a way of representing binary data (like image bytes, encryption keys, or non-ASCII text) using only 64 printable ASCII characters. It's used everywhere: email attachments, data URIs in CSS/HTML, JWT payloads, embedded images, API tokens, PGP-armored keys, and more.

Our encoder is UTF-8 safe (correctly handles emoji and non-Latin scripts), supports URL-safe encoding for JWT/URL contexts, and handles files up to 10 MB entirely client-side.

100% client-side: No file is ever uploaded. All encoding and decoding happens in your browser using btoa, atob, and TextEncoder/TextDecoder. Your data never touches our servers.

How to use Base64 Encoder

Get the encoded (or decoded) result in three simple steps:

1

Pick a mode

Choose Text mode to encode/decode strings, or File mode to convert files into raw Base64 or Data URIs.

2

Paste or drop

Paste text into the input, or drag a file onto the drop zone. Toggle URL-safe / line wrap options if needed.

3

Encode or Decode

Hit the button. Copy the result to your clipboard or download it as .txt.

Key Features

UTF-8 safe encoding

Raw btoa in JavaScript breaks on any non-ASCII character (emoji, accents, CJK). Ours wraps encoding with TextEncoder so you can encode "Hello, 世界! 👋" without errors.

URL-safe Base64 variant

One-click toggle swaps +/= for -_. Perfect for JWT payloads, URL query params, base64url-encoded API tokens, and PGP armor.

File to Base64 (any file type)

Drop a file (up to 10 MB) and get either raw Base64 or a full Data URI (data:image/png;base64,…) ready to paste into <img src>, CSS background-image, or a Markdown image tag.

MIME-standard line wrap

Optional 76-column wrap matches the MIME/RFC 2045 standard for email attachments and PEM-formatted keys. Choose 64/80 cols too, or no wrap at all.

Bidirectional with Swap

Encode → Decode round-trip works both ways. The Swap button moves output back to input so you can chain conversions.

Copy + Download

Copy button puts the result on your clipboard with a toast confirmation. Download button saves as a proper .txt file — filename derived from your input file when in file mode.

Keyboard shortcut

Ctrl+Enter (or Cmd+Enter) triggers Encode in text mode — the fastest possible round-trip.

Common Use Cases

  • Encode an image or icon as a Data URI to embed directly in HTML or CSS
  • Decode a JWT payload to inspect its claims (use URL-safe mode)
  • Encode a small binary file for pasting into a JSON API request body
  • Decode Base64 chunks copied from email raw source (MIME attachments)
  • Convert an image into a shareable copy-pasteable string for chat or docs
  • Prepare a PGP-armored key by hand, one section at a time
  • Embed a small SVG or font in a CSS @font-face or background-image
  • Roundtrip-test your app's Base64 encoding to isolate encoding bugs

Security & Privacy

We take your data seriously. Here's how we protect the text and files you convert:

  • 100% client-side processing: encoding and decoding runs in your browser using built-in JavaScript APIs. No file, no text, no result is ever uploaded to our servers.
  • Works offline: once the page loads, you can turn off your internet and everything keeps working. Nothing needs the network.
  • No tracking of content: we don't see, log, or store what you encode or decode. There's nothing for us to see.
  • File size cap: 10 MB per file — a safety limit to keep the browser responsive, not for privacy (files never leave your machine).
  • No accounts required: use it fully anonymously — no signup, no cookies for the tool itself.

Frequently Asked Questions

No. Everything runs in your browser via btoa, atob, and FileReader.readAsDataURL. Your text and files never leave your device.
A variant that swaps +/= for -_. — safe for use inside URLs and JWT payloads without needing URL encoding. Toggle the URL-safe checkbox to switch.
Yes. We wrap encoding with TextEncoder so any Unicode input round-trips correctly — try our sample string "Hello, 世界! 👋".
Yes — the decoder strips the data:mime;base64, prefix automatically. Just paste the whole thing.
10 MB per file to keep the browser responsive. There's no size limit for text mode — but very long strings may slow down the browser.
Completely free. No signup, no ads, no daily limits.