Base64 Encoder/Decoder

Free online Base64 encoder and decoder for text and data

This online Base64 encoder and decoder converts plain text to Base64 and decodes Base64 strings back to readable text directly in your browser.

Quickly encode text to Base64 or decode Base64 strings with instant copy, paste, download and clipboard support — no server upload required.

Input Base64

Decoded Text

What is Base64?

Base64 is a binary-to-text encoding scheme that represents arbitrary binary data using a 64-character ASCII alphabet. It converts bytes into a safe, printable string that can be transmitted through channels originally designed for text only, such as email bodies, JSON payloads, XML documents, HTTP headers or URL query parameters.

Base64 is encoding, not encryption — it provides no confidentiality. It simply ensures that binary content survives transport through systems that may otherwise corrupt non-ASCII bytes.

Why Use a Base64 Encoder and Decoder?

Developers need a reliable Base64 encoder/decoder when inspecting API tokens, decoding JWT header or payload segments, debugging HTTP Basic Authentication strings, generating data URIs for images, or converting binary files into a text-friendly form. A dedicated online tool removes the need to write throwaway scripts or open a terminal just to run btoa/atob.

Our encoder also handles Unicode correctly by UTF-8 encoding text before Base64, which avoids the classic "InvalidCharacterError" you get from calling btoa() directly on non-ASCII strings.

How to Encode and Decode Base64 Online (Step by Step)

Using this Base64 converter takes only a few seconds:

  1. Paste your plain text or Base64 string into the left editor, or click Sample to load an example.
  2. Toggle the mode: choose Encode from Text to Base64 or Decode from Base64 to Text.
  3. The result appears instantly in the right editor as you type — no Submit button needed.
  4. Use Copy to send it to your clipboard or Download to save it as a .txt file.

Why Choose Our Base64 Tool?

Our Base64 encoder/decoder runs 100% in your browser using the native btoa() and atob() APIs wrapped with UTF-8 safe helpers. There are no uploads, no tracking, no ads and no registration. The interface is built around a Monaco editor for syntax-aware editing, fullscreen mode, and fast handling of long strings.

The tool works equally well for small snippets (API keys, auth headers) and for larger payloads such as JWT tokens, email MIME parts or embedded data URIs.

How Base64 Encoding Works

Base64 groups input bytes into blocks of 3 bytes (24 bits) and splits them into 4 groups of 6 bits. Each 6-bit group (0–63) is mapped to a character in the Base64 alphabet: A–Z, a–z, 0–9, + and /. The result is always a multiple of 4 characters long.

When the input length is not a multiple of 3, the encoder pads the output with one or two = characters so that downstream parsers can recover the original byte length. The URL-safe variant (RFC 4648 §5) replaces + with - and / with _ so the string can safely appear in URLs and filenames.

Features

  • Encode / decode toggle — switch direction with a single radio button.
  • Unicode-safe — full UTF-8 support for emoji, Cyrillic, CJK and other non-ASCII text.
  • Paste from clipboard — one-click import from your OS clipboard.
  • Copy to clipboard — copy the result with a single button.
  • Download as file — save the output as encoded_text.txt or decoded_text.txt.
  • Sample data — preloaded examples for both encoding and decoding.
  • Monaco editor — word wrap, fullscreen, syntax-aware highlighting.
  • Client-side only — nothing leaves your browser.

Common Use Cases

Base64 encoding shows up almost everywhere in web development and systems integration. Typical scenarios include:

  • Data URIs — inline images, fonts or SVGs in HTML and CSS (data:image/png;base64,...).
  • Email attachments — MIME encoding of binary parts for SMTP transport.
  • HTTP Basic Authentication — encoding username:password for the Authorization header.
  • API tokens and secrets — safely transporting binary keys inside JSON and headers.
  • JWT header and payload — decoding the first two Base64URL-encoded segments of a JSON Web Token.
  • Storing binary blobs — persisting small binary data in text-only fields (localStorage, JSON columns).
  • Webhooks and queues — embedding binary payloads in message bodies.

Is It Safe to Encode and Decode Base64 Online?

Yes. This tool performs all encoding and decoding locally in your browser using the native btoa() and atob() APIs. Your text is never uploaded to our servers, there is no telemetry on the input, and no logs are kept of the data you paste.

Still, remember that Base64 is not a security mechanism. Anyone who receives the encoded string can trivially decode it. Never rely on Base64 to hide passwords, API keys or sensitive personal information — use proper encryption or secret management for that.

Why Choose DevTools?

DevTools is a free, ad-free suite of utilities built by developers for developers. Each tool is designed to load fast, work offline after the first visit, and respect your privacy by running entirely in the browser. The Base64 encoder/decoder is part of a larger family of encoding, formatting and conversion tools that share a consistent UI and keyboard-friendly workflow.

Whether you are debugging an API, crafting an email template, or inspecting a JWT, you can move between DevTools utilities without leaving the tab — no accounts, no rate limits, no upsell.

Download, Copy and Related Tools

After encoding or decoding, copy the result to your clipboard or download it as a plain text file. If you need different formats or related conversions, jump directly to one of our companion utilities:

FAQ

Why does a Base64 string sometimes end with one or two "=" characters?

The = characters are padding. Base64 output length must be a multiple of 4, so when the input byte length is not a multiple of 3, one or two = are appended to indicate how many bytes were padded.

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

URL-safe Base64 (RFC 4648 §5) uses - and _ instead of + and / so the result can be used in URLs, filenames and JWTs without further percent-encoding.

Does this tool support Unicode text (emoji, Cyrillic, CJK)?

Yes. The encoder UTF-8 encodes your text before calling btoa(), and the decoder reverses that, so arbitrary Unicode input works correctly.

Is there a maximum size I can encode or decode?

There is no hard limit set by the tool. Practical size is bounded by your browser's memory — strings of several megabytes are handled smoothly on modern machines.

How is Base64 different from HEX encoding?

Both represent binary data as text. HEX uses 16 characters and produces output that is 2× the input length; Base64 uses 64 characters and produces output that is ~1.33× the input length, making it more compact for transmission.

Is it safe to paste sensitive data here?

All encoding/decoding happens locally in your browser — no data is sent to our servers. That said, Base64 is not encryption. Do not rely on Base64 to protect secrets; use proper cryptography for confidentiality.

Why do I sometimes get an error when decoding?

Decoding fails when the input contains characters outside the Base64 alphabet, has incorrect padding, or mixes URL-safe and standard variants. Check that the string only contains A–Z a–z 0–9 + / = (or - _ for URL-safe).

Base64 Learning Resources

To deepen your understanding of Base64 encoding, consult the following authoritative references: