Base64 Encoder / Decoder

Your data never leaves your browser

Encode text to Base64 or decode Base64 back to text. Supports standard and URL-safe variants. Runs 100% in your browser.

Input - Plain Text
Output - Base64
Ctrl+Shift+CCopyCtrl+KClearCtrl+DDownload

Share this tool

Found it useful? Help a fellow developer discover it.

https://developertoolkit.dev/tools/base64

What is Base64?

Base64 is an encoding scheme that converts binary data into a sequence of printable ASCII characters using an alphabet of 64 symbols (A–Z, a–z, 0–9, +, /). Every 3 bytes of input becomes 4 Base64 characters, making the output approximately 33% larger than the original. It is widely used to safely transmit binary data over text-based protocols: embedding images in HTML or CSS (data URIs), encoding email attachments (MIME), passing binary payloads in JSON, and storing credentials in HTTP Basic Authentication headers. The URL-safe variant replaces + with - and / with _, making it safe for use in URLs and filenames without percent-encoding.

How to use the Base64 Encoder / Decoder

  1. Select Encode or Decode mode using the toggle in the options bar.
  2. Paste or type your input into the left panel.
  3. The output appears instantly in the right panel. Press Ctrl+Enter to re-run manually.
  4. Use the Variant selector to switch between Standard Base64 (for MIME, HTTP headers) and URL-safe Base64 (for URLs, JWT tokens, filenames).
  5. Click Swap ⇄ to move the output into the input panel, which is useful for quickly reversing the operation.

Common Base64 use cases

Frequently Asked Questions

How do I decode a Base64 string to plain text?

Select Decode mode using the toggle in the options bar, then paste the Base64 string into the input panel. The decoded text appears instantly in the output. Whitespace and line breaks within the Base64 string are stripped automatically before decoding, so you can paste multi-line encoded strings directly.

What is a Base64 data URI and how do I use one?

A data URI embeds file content directly in HTML or CSS using the format data:[mediatype];base64,[data]. For example, data:image/png;base64,iVBORw0K... embeds a PNG image inline, eliminating an HTTP request. Use the Image to Base64 tool to generate data URIs from image files. This tool handles text-based encoding for string payloads.

Is my data kept private when using this tool?

Yes. All encoding and decoding happens entirely in your browser using the native btoa() and atob() Web APIs. Your input is never sent to any server.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses + and / in its alphabet and pads output with = characters. These characters have special meaning in URLs, so URL-safe Base64 replaces + with - and / with _ and omits the = padding. URL-safe Base64 is used in JWT tokens, OAuth, and anywhere Base64 appears inside a URL or filename.

Why does Base64 make the output larger?

Base64 encodes every 3 bytes of input as 4 ASCII characters. This 4/3 ratio means the output is always about 33% larger than the input. This size cost is the tradeoff for making binary data safe to transmit over text-only channels.

Can I encode images or binary files with this tool?

This tool encodes and decodes text (UTF-8 strings). For binary files like images, use the Image to Base64 tool which reads raw bytes via the FileReader API. Base64 data URIs for images are binary-encoded, not text-encoded.

Why do I get an error when trying to decode some Base64 strings?

Two common causes: (1) The string contains invalid Base64 characters. Base64 only uses A-Z, a-z, 0-9, +, /, and = for padding. (2) The decoded bytes are not valid UTF-8. This happens when the original input was binary data such as an image or compressed file rather than a text string.

Is Base64 a form of encryption?

No. Base64 is an encoding scheme, not encryption. It is trivially reversible by anyone without any key or secret. Never use Base64 to hide sensitive data. Use proper encryption such as AES or RSA for that purpose.

Related Tools