Base64 Encoder & Decoder

Encode any text, JSON, or UTF-8 content to Base64, or decode a Base64 string back to plain text. Supports URL-safe Base64, optional padding removal, MIME line wrapping (64 or 76 characters), and automatic data URL decoding. Runs entirely in your browser, nothing is uploaded.

13 chars · 13 bytes
20 chars · 20 bytes
Input: 13 bytesEncoded: 20 charsOverhead: +54%
TL;DR, paste text to encode, paste Base64 to decode, copy or download the result.

This free Base64 encoder and decoder runs entirely in your browser. Paste any text to get the Base64 output instantly, or paste a Base64 string to decode it back. Supports URL-safe mode, padding control, MIME line widths, and full data URL decoding. Nothing is uploaded.

Free Online Base64 Encoder and Decoder

Encode any text, JSON, or UTF-8 content to Base64, or decode a Base64 string back to readable plain text. This tool supports URL-safe Base64, optional padding removal, MIME line wrapping at 64 or 76 characters, and automatic extraction from data URLs. It runs entirely in your browser with no uploads and no account needed.

The encoder is UTF-8 aware, so emoji, accented characters, and non-Latin scripts survive a full encode-decode round-trip without corruption. A live stats bar shows the input size, encoded length, and the size overhead so you always know what you are working with.

What is Base64 encoding?

Base64 is an encoding scheme that converts binary or text data into a string of 64 printable ASCII characters. It uses the alphabet A-Z, a-z, 0-9, +, and / (with = as padding). Every 3 bytes of input become 4 Base64 characters, which is why Base64-encoded data is roughly 33% larger than the original.

The main purpose of Base64 is to let you embed binary data in systems that only handle text, such as email bodies, JSON fields, HTML attributes, and HTTP headers. It is not encryption. There is no key, and anyone can decode it instantly. If you need to keep data confidential, use encryption before encoding.

How to use this Base64 encoder and decoder

  1. To encode: type or paste your plain text, JSON, or any UTF-8 content into the left panel (labeled "Plain Text"). The Base64 output appears instantly on the right.
  2. To decode: paste a Base64 string or a full data URL into the right panel (labeled "Base64"). The decoded text appears instantly on the left. You can also use the swap button to flip the panel roles.
  3. Set options: toggle URL-safe mode, remove = padding, or choose a line width of 64 or 76 for email and certificate use cases.
  4. Copy or download: click Copy on any panel, or use Download to save the output as a .txt file. You can also upload a text file directly into either panel.

Common use cases for Base64

  • JWT tokens: the header and payload of a JSON Web Token are Base64url-encoded. Decode them here to inspect claims without a dedicated JWT library. For working with the raw JSON inside, JSON Formatter can pretty-print and validate the decoded content.
  • HTTP Basic Auth: credentials are sent as username:password encoded in Base64 inside the Authorization header. Decode an existing header here to verify the credentials are correct.
  • Email MIME encoding: email attachments and non-ASCII content are Base64-encoded with 76-character lines per RFC 2045. Use the 76-char line option to generate MIME-compatible output.
  • Inline images and CSS: small icons can be embedded directly in HTML or CSS as Base64 data URLs (data:image/svg+xml;base64,...) to eliminate an HTTP request.
  • URL-safe tokens: URL-safe Base64 carries binary data in query strings and cookie values without percent-encoding. For URL percent-encoding specifically, use the URL Encoder/Decoder.
  • Debugging API responses and webhooks: decode opaque Base64 blobs from logs and API payloads in one step, without uploading data to an external service.
  • PEM certificates and SSH keys: these use Base64 with 64-character line wrapping. Use the 64-char line option to generate PEM-compatible blocks.

Key features

  • UTF-8 safe encoding so emoji, accented letters, and non-Latin scripts round-trip without corruption.
  • URL-safe Base64 option that swaps + and / for - and _ for use in URLs, cookies, and JWT tokens.
  • Optional padding removal when your API or token consumer expects unpadded Base64.
  • Line wrapping at 64 or 76 characters to match PEM or MIME email standards respectively.
  • Decoder accepts full data URLs, strips prefixes automatically, and restores missing padding.
  • Per-panel Upload and Download buttons so you can work directly with .txt files.
  • Live stats bar showing input size, encoded length, and the size overhead percentage.
  • Sample presets (plain text, JSON, emoji) to explore the tool immediately.
  • 100% client-side, private, no uploads, no account needed.

Tips for working with Base64

  • Use URL-safe mode with no padding for JWT tokens, query strings, and cookie values when your consumer supports it.
  • If you are unsure what your API expects, keep padding enabled. Many decoders require the length to be a multiple of 4.
  • Choose 76-character line breaks for MIME email and 64-character breaks for PEM keys and certificates.
  • If decoding fails, check for stray whitespace or non-Base64 characters. The tool trims whitespace automatically, but broken characters can still cause errors.
  • Base64 is encoding, not encryption. For real confidentiality, combine it with a proper cipher. Try our Secure Text Encryptor for AES encryption.
  • To inspect a data URL from HTML or CSS, paste the entire string including the data: prefix and the tool pulls out the Base64 payload for you.

Frequently asked questions

What is Base64 encoding?
Base64 converts binary or text data into a string of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It lets you embed bytes safely inside text-only systems like email headers, JSON, HTML, and URLs. The name comes from using a 64-character alphabet to represent every 6 bits of the original data.
Is Base64 encryption?
No. Base64 is a fully reversible encoding with no secret key. Anyone who has a Base64 string can decode it instantly. It is designed to transport bytes safely through text pipelines, not to keep data private. If you need real encryption, try our Secure Text Encryptor which uses AES-256.
Is this Base64 encoder private?
Yes. Everything runs locally in your browser tab. Your input is never sent to a server, logged, or stored anywhere outside your device. This makes it safe to use even with API tokens or configuration values.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs. URL-safe Base64 replaces them with - and _ so the output works cleanly in query strings, cookies, filenames, and JWT tokens without percent-encoding.
Why does my Base64 string end with = or ==?
Base64 processes input in 3-byte groups and outputs 4 characters per group. When the input length is not a multiple of 3, = padding is added to make the output length a multiple of 4. One or two equals signs means 1 or 2 padding bytes. Some APIs require padding; others accept it without.
Can I decode a Base64 image or data URL?
Yes. Paste the complete data URL, for example data:image/png;base64,iVBORw0KGgo..., into the right panel. The tool automatically detects the prefix, strips it, and decodes the Base64 portion. Note that the decoded output is the raw bytes represented as text, which is useful for inspection or round-trip testing.
What line width should I use?
Use 76 characters per line for MIME email encoding (defined in RFC 2045). Use 64 characters per line for PEM-format certificates, SSH keys, and similar formats. Leave line width at None for APIs, JWTs, and most modern use cases that expect a single continuous string.
How do I encode text to Base64 online for free?
Type or paste your plain text, JSON, or any UTF-8 content into the left panel. The Base64-encoded output appears instantly in the right panel. Click Copy or use Download to save it. No account, no software, no upload required.
How do I decode a Base64 string online?
Paste your Base64 string into the right panel and the decoded plain text appears immediately in the left panel. The decoder handles standard Base64, URL-safe Base64, data URLs, and strings with or without = padding.
What can I encode with this tool?
Any UTF-8 text: plain text, JSON payloads, API credentials, JWT claims, configuration snippets, or data URLs. The encoder correctly handles emoji, accented characters, Arabic, Chinese, and other non-ASCII scripts through proper UTF-8 byte conversion before encoding.

Related tools

URL Encoder/Decoder · JSON Formatter · Hash Generator · Secure Text Encryptor · Password Generator · QR Code Generator

Related tools