Base64
Result will appear here…

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to text instantly. Supports URL-safe mode, file upload, and one-click copy. All processing runs in your browser.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It works by taking groups of three bytes (24 bits) and splitting them into four 6-bit values, each mapped to a character from a 64-character alphabet (A-Z, a-z, 0-9, +, /). The result is a text string that is roughly 33% larger than the original data but is safe to transmit through text-based protocols like email, HTTP headers, and JSON.

This free online Base64 tool encodes and decodes text in real time as you type. It supports both standard Base64 (RFC 4648) and URL-safe Base64, which replaces + with - and / with _ to make encoded strings safe for use in URLs and filenames. All processing happens entirely in your browser — your data is never sent to any server.

Key Features

  • Real-time encoding and decoding — output updates instantly as you type or paste
  • Standard Base64 (RFC 4648) with proper padding
  • URL-safe Base64 mode — replaces +/ with -_ and removes padding for URL-compatible output
  • Swap button to quickly switch between encode and decode modes while preserving output
  • File upload support for encoding or decoding text files
  • One-click download of the output as a text file
  • Copy to clipboard with a single click
  • Fullscreen mode for working with large texts
  • Full UTF-8 support — correctly handles multi-byte characters including emoji and CJK text
  • 100% client-side processing — your data never leaves your browser

How to Use This Tool

  1. Select the mode: Encode (text to Base64) or Decode (Base64 to text).
  2. Type or paste your input in the left panel. The result appears instantly in the right panel.
  3. Toggle URL-safe mode if you need the output to be safe for URLs and filenames.
  4. Use the swap button to switch modes and feed the output back as input.
  5. Click Copy to copy the result, or Download to save it as a file.

Why Use Base64 Encoding?

Base64 encoding is essential whenever you need to embed binary data in a text-based format. Common scenarios include embedding images in HTML or CSS using data URIs, transmitting binary files through JSON APIs, encoding email attachments via MIME, and storing binary data in text-only databases or configuration files. Without Base64, binary data containing null bytes or non-printable characters would corrupt these text-based channels.

URL-safe Base64 is particularly important for web applications. Standard Base64 uses + and / characters that have special meaning in URLs and could break query parameters or path segments. URL-safe encoding substitutes these with - and _, making the output safe to include directly in URLs, cookies, and HTML attributes without additional percent-encoding.

Common Use Cases

  • Embedding images in HTML/CSS — convert small images to Base64 data URIs to reduce HTTP requests
  • API development — encode binary payloads for transmission in JSON request and response bodies
  • Email encoding — MIME uses Base64 to encode email attachments and non-ASCII text content
  • JWT tokens — the header and payload of JSON Web Tokens are Base64url-encoded JSON strings
  • Data storage — store binary data in text-based databases, environment variables, or config files
  • Web authentication — HTTP Basic Authentication encodes credentials as Base64
  • Debugging — decode Base64 strings found in logs, cookies, or API responses to inspect their contents

Base64 and Security

Base64 is an encoding scheme, not an encryption method. It provides no security whatsoever — anyone can decode a Base64 string instantly without any key or password. Never use Base64 alone to protect sensitive data like passwords, API keys, or personal information. For security, use proper encryption algorithms (AES, RSA) or hashing functions (SHA-256, bcrypt).

That said, Base64 is frequently used as a transport layer in security protocols. For example, TLS certificates are PEM-encoded (Base64), JWTs use Base64url encoding, and SAML assertions are Base64-encoded XML. In these cases, Base64 serves only to make binary data text-safe — the actual security comes from digital signatures and encryption applied before encoding.

Tips for Working with Base64

  • Use URL-safe Base64 when the output will appear in URLs, filenames, or HTML attributes
  • Remember that Base64 increases data size by approximately 33% — consider this for bandwidth-sensitive applications
  • For large files, Base64 encoding in the browser may be slow — use server-side tools or command-line utilities for files over 10MB
  • When decoding, the tool automatically handles both standard and URL-safe variants
  • Base64 padding (= characters) is optional in many implementations — this tool handles both padded and unpadded input

Frequently Asked Questions