Base64 Encoder & Decoder

🔒 Your data never leaves your browser - 100% local processing
Mode:
Encode or Decode
Advertisement

How to Use This Base64 Encoder/Decoder

  1. Pick Text Mode or File ModeChoose between Text Mode and File Mode using the tabs at the top. Text Mode handles plain text and string encoding, while File Mode works with any file type including images, PDFs, and documents.
  2. Encode or decode textIn Text Mode, select Encode or Decode, then type or paste your content. Encoding converts readable text into a Base64 string. Decoding converts a Base64 string back into readable text. The conversion happens instantly as you type.
  3. Convert files to Base64In File Mode, drag and drop a file (or click to browse) to encode it to Base64. The tool reads the file, converts it, and displays the full Base64 string. Toggle "Include data URI prefix" to prepend the standard data:mime;base64, header used in HTML and CSS. For images, a preview is shown automatically.
  4. Decode Base64 back to a fileTo decode a Base64 string back to a file, switch to Decode mode in File Mode, paste the Base64 string, and click "Download Decoded File." The tool auto-detects the file type from the data URI prefix if present.
  5. Use URL-safe output and copy controlsEnable URL-safe Base64 for strings that will be used in URLs or filenames - this replaces characters that have special meaning in URLs. Click "Copy Output" to copy the result, "Swap" to reverse the operation, or "Download as .txt" to save long outputs as a text file.

All processing happens locally in your browser. No data is ever sent to a server.

Advertisement

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of ASCII characters. It uses 64 characters — the uppercase and lowercase Latin letters (A–Z, a–z), digits (0–9), plus (+), and forward slash (/) — with equals (=) used for padding. This limited character set ensures the encoded data can be safely transmitted through systems that only handle text, which is why a Base64 encoder/decoder is indispensable for web developers and API users.

The Base64 alphabet

64-character alphabet + padding A–Z   a–z   0–9   +   /   (= padding)

How the 3-to-4 conversion works

The encoding works by taking three bytes (24 bits) of binary data and splitting them into four 6-bit groups. Each 6-bit group maps to one of the 64 characters. This means Base64 encoded data is always approximately 33% larger than the original binary data — three input bytes become four output characters.

Data URIs and inline images

The most common use of Base64 in web development is embedding images directly in HTML or CSS. Instead of linking to an external image file, you can include the image data inline as a data URI: data:image/png;base64,iVBOR... This eliminates an HTTP request but increases the HTML file size. It's most effective for small images like icons.

Where Base64 shows up

Base64 is also essential in email (MIME encoding), JSON Web Tokens (JWT), API authentication headers (Basic Auth), and storing binary data in text-only formats like XML and JSON. While Base64 makes binary data text-safe, it is not encryption — Base64 can be trivially decoded by anyone.

URL-safe Base64

URL-safe Base64 is a variant that replaces + with - and / with _ to avoid conflicts with URL syntax. This variant is used in JWT tokens, URL parameters, and filenames where the standard Base64 characters would cause parsing issues.

Base64 Tool Features

  • Text modeEncode and decode strings in real time as you type.
  • File modeDrag-and-drop any file (image, PDF, audio, archive) to get its Base64 string.
  • Image previewSee the image you are encoding or decoding before copying.
  • Data URI toggleAdd or remove the data:mime;base64, prefix with one click.
  • URL-safe Base64Produce JWT/OAuth-ready strings with -, _, and no padding.
  • Auto MIME detectionDecoding automatically picks the right file extension (png, jpg, pdf, mp3…).
  • Copy, swap, and downloadOne-tap controls including saving long outputs as .txt.
  • Runs offlineAll encoding/decoding happens in your browser with no network traffic.

Common Uses for a Base64 Encoder/Decoder

  • Inline images in HTML & CSSEmbed small icons or SVGs as data:image/png;base64,... to cut HTTP requests.
  • Decode JWT tokensJWT payload is Base64url-encoded JSON; decode it here, then format the JSON in our JSON Formatter.
  • HTTP Basic Auth headersBuild the Authorization: Basic <base64(user:pass)> header for API testing with cURL or Postman.
  • Email attachments (MIME)Inspect or craft base64-encoded MIME parts in raw email messages.
  • Mobile app / SDK assetsBundle small images or fonts as base64 strings inside app config.
  • Webhooks & APIsAPIs like Stripe, Twilio, and Slack sometimes accept or return base64 payloads for files.
  • QR code payloadsGenerate a compact base64 string before encoding it into a QR code with our QR Code Generator.
  • Database BLOB workaroundsStore binary data inside text columns that do not support BLOB types.

Frequently Asked Questions

No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string - it provides no security. Its purpose is to convert binary data into text-safe characters for transmission, not to hide information. Never use Base64 alone to protect sensitive data.
Base64 encodes every 3 bytes of input into 4 characters of output, making it approximately 33% larger. This overhead is the trade-off for converting binary data into a text-safe format. For example, a 30 KB image becomes roughly 40 KB when Base64 encoded.
Yes. Base64 can encode any binary data - images, PDFs, audio files, executables, archives, or any other file type. The output is always a plain text string regardless of the input format. However, very large files will produce extremely long strings.
A data URI embeds file content directly in HTML or CSS using the format data:[mime];base64,[data]. Use it for small images (under 5-10 KB) to eliminate HTTP requests. For larger files, external URLs are more efficient because browsers can cache them separately.
Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ and removes = padding, making the output safe for use in URLs, filenames, and query parameters. It's commonly used in JWT tokens.
Open File Mode, drag the image in, and the Base64 string plus a live preview appear instantly. Toggle the data URI prefix to get a ready-to-paste `data:image/png;base64,...` string for HTML img tags or CSS background-image URLs.
Switch to File Mode > Decode, paste the Base64 string (with or without the data URI prefix), and click Download. The tool auto-detects PNG, JPG, SVG, GIF, WebP, PDF, and other MIME types from the prefix or the binary signature.
Base64url (URL-safe Base64) is a variant used in JSON Web Tokens (JWT), OAuth, and URL parameters. It replaces + with -, / with _, and usually omits the = padding so the string is safe inside URLs and filenames.
Equals signs are Base64 padding. Base64 encodes in 3-byte groups, producing 4-character output blocks. When the input is not a multiple of 3, one or two = characters are added so the output still aligns to 4-character blocks. They carry no data and can be safely stripped in URL-safe mode.
No. Base64 is a reversible encoding, not encryption. Anyone can decode a Base64 string instantly. Use proper cryptography (AES, RSA) to protect secrets — Base64 only makes data text-safe for transport, not private.
Yes. Everything runs in your browser with zero network calls after the first load. It works on iPhone, Android, and desktop, and it is fine with large files — the only limit is your device's memory.