Base64 Encoder & Decoder

Encode text or JSON to Base64 and decode Base64 back to UTF-8. Includes URL-safe mode, optional padding, line wrapping (64/76), and data URL decoding. Runs locally in your browser.

Free Online Base64 Encoder & Decoder – Encode & Decode Base64 Instantly

Encode any text or data to Base64, or decode a Base64 string back to readable text. Supports URL-safe Base64, optional padding removal, MIME line-wrapping, and full data URL decoding — all locally in your browser with no uploads and no account needed.

The encoder is UTF-8 aware, so Emoji, non-Latin scripts, and accents survive a full encode/decode round-trip. You can switch to the URL-safe Base64 variant when you need values for query strings, cookies, filenames, or JWTs. You decide whether to keep or remove = padding, and whether to wrap lines at 64 or 76 characters to match common conventions (76 is the MIME standard used in many email systems). The decoder is forgiving: it trims whitespace, accepts URL-safe input, restores missing padding, and can extract the payload from a full data URL.

How to use the Base64 Encoder & Decoder

  1. Enter your input
    To encode text to Base64, type or paste plain text, JSON, or other UTF-8 content in the left panel. To decode Base64 to text, paste a Base64 string or full data URL in the right panel.
  2. Choose options (optional)
    Toggle URL-safe, Remove padding, and pick a line width (None, 64, or 76 for MIME). The tool is compatible with common APIs, JWT libraries, and email encoders.
  3. Copy / Upload / Download
    Use Copy on any panel to grab the current text, Upload a .txt file to either side to encode or decode it, or Download the current output as .txt to save it locally.
  4. Fix invalid inputs
    Base64 works in blocks of four characters. If decoding fails, check for stray characters, remove spaces or line breaks that don’t belong, or paste the full data URL so the tool can extract the Base64 segment for you.

Common uses for Base64 encoding

Base64 encoding appears throughout web development and system integration. Here are the most common places you’ll need this tool:

  • JWT tokens — the header and payload sections of a JSON Web Token are Base64url-encoded. Decode them here to inspect claims without a dedicated JWT library.
  • API authentication headers — HTTP Basic Auth encodes credentials as username:password in Base64 before adding them to the Authorization header.
  • Email MIME encoding — email clients encode attachments and non-ASCII content in Base64 with 76-character line wrapping (the MIME standard). Use the 76-char line option here to match that format exactly.
  • Embedding small images in CSS/HTML — convert small icons or sprites to a Base64 data URL (e.g., data:image/svg+xml;base64,…) to inline them directly in your stylesheet or HTML without an extra HTTP request.
  • Query strings and cookies — URL-safe Base64 (with -/_ instead of +//) carries binary data safely in URL parameters and cookie values.
  • Debugging opaque blobs — inspect Base64 strings from logs, webhooks, and API responses by pasting and decoding in one tab, without uploading data to an external service.

What Base64 is — and isn’t: it’s an encoding scheme, not a cipher. Base64’s job is to make bytes safe for text-only pipelines, not to hide secrets. If you need confidentiality, combine this tool with proper encryption. For percent-encoding of URLs, head to URL Encoder/Decoder. Working with JSON payloads that you later Base64-encode? Use JSON Formatter to pretty-print and validate them before encoding. Sharing those links or tokens visually? The QR Code Generator turns any URL or identifier into a scannable QR code in seconds.

Key features of this Base64 encoder & decoder

  • Free online Base64 encoder and decoder that runs 100% in your browser — no uploads, no tracking, no sign-up.
  • UTF-8 safe encoding and decoding so emoji, accented characters, and non-ASCII scripts round-trip correctly.
  • URL-safe Base64 option that replaces + and / with - and _ for query strings, cookies, JWTs, and filenames.
  • Optional removal of trailing = padding when your API, CDN, or token consumer allows unpadded Base64.
  • Configurable line breaks at 64 or 76 characters (76 is the MIME standard used in many email systems).
  • Decoder accepts full data URLs (for example, images), trims whitespace, restores missing padding, and accepts URL-safe input.
  • Per-panel Upload and Download, one-click Copy, Swap panels, and optional line wrapping for easier inspection.
  • Works well for JSON payloads, API tokens, small file snippets, and debugging Base64 blobs from logs and webhooks.

Tips for working with Base64 safely

  • Use the URL-safe Base64 option with no padding for query strings, cookies, JWT tokens, and filenames when your consumer supports it.
  • If you are not sure what your API expects, keep padding enabled — many Base64 decoders require a length that is a multiple of 4.
  • Choose 76-character lines for MIME email bodies; 64-character lines are common in PEM-style certificate and key blocks.
  • If the decoder reports an error, check for stray spaces or non-Base64 characters and make sure the length ends up at a multiple of 4. Padding fixes lengths with remainder 2 or 3.
  • Remember that Base64 is encoding, not encryption. For secrets, combine this tool with a proper encryption tool or library.
  • When debugging a data URL, paste the entire string (including data: and base64,) so the tool can automatically pull out the Base64 section.

Frequently asked questions about Base64

Is Base64 encryption?
No. Base64 doesn’t hide meaning — it just represents bytes as readable text. Anyone can decode it. If you need confidentiality, use an encryption tool or library in addition to this Base64 encoder and decoder.
Is this Base64 encoder secure and private?
Yes. This is a browser-based Base64 encoder and decoder. All encoding and decoding happens locally in your browser tab; nothing is sent to a server. As long as your device is safe, it’s a good choice for sensitive API tokens or logs.
What is URL-safe Base64?
URL-safe Base64 swaps +// for -/_ so the string works cleanly in URLs, filenames, and cookies. Many systems also drop the trailing = padding in this mode, which this tool can generate for you.
Why do I see '=' at the end of a Base64 string?
Those = characters are padding. Base64 works in blocks of 4 characters; padding is added so the total length is a multiple of 4. Some decoders need it, others don’t. If a consumer complains, try toggling the padding setting here.
Can I decode a full data URL or Base64 image?
Yes. Paste the entire string (for example, data:image/png;base64,AAAA…) into the right panel. The tool automatically detects the data URL, extracts the Base64 portion, and decodes it back to text or bytes.
What kinds of things can I encode with this Base64 tool?
Anything that can be represented as text: JSON payloads, API responses, small file snippets, image data URLs, configuration blobs, or opaque tokens. Paste the text, encode to Base64, then use the Copy and Download buttons to move it into your app or workflow.
How do I encode text to Base64 online for free?
Type or paste your plain text, JSON, or UTF-8 content in the left panel and the Base64-encoded output appears instantly in the right panel. Click Copy to grab the result. No account or software needed.
How do I decode a Base64 string online?
Paste your Base64 string into the right panel and the decoded text appears immediately in the left panel. The decoder handles standard Base64, URL-safe Base64, and strings with or without padding.