Glyph WidgetsGlyph Widgets
AboutContactBlogPrivacyTermsSupport on Ko-fi

© 2026 Glyph Widgets. All rights reserved.

·

100% Client-Side Processing

Back to Blog

Base64 Encoder/Decoder: Free Online Tool

Base64 encoder and decoder with Unicode support, URL-safe mode, and batch processing. Real-time conversion with no server upload.

Glyph Widgets
February 27, 2026
10 min read
base64 encoderbase64 decoderbase64 onlineencode base64decode base64

What Is the Base64 Encoder/Decoder?

The Base64 Encoder/Decoder converts text to Base64-encoded strings and decodes Base64 strings back to plain text. Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters, making it safe to transmit through systems that handle only text — email protocols, JSON fields, HTTP headers, and data URLs. This tool solves two common problems: encoding arbitrary text (including Unicode characters) into a portable ASCII string, and decoding Base64 strings from logs, API responses, or JWT payloads back to readable text. All processing happens in your browser using standard Web APIs. No text is sent to any server, and no account is required.

Key Features

  • Encode text to Base64 — converts any plain text string to its Base64 representation using TextEncoder for proper byte handling before btoa().
  • Decode Base64 to text — reverses the process using atob() and TextDecoder, correctly handling multi-byte UTF-8 sequences.
  • Full Unicode/UTF-8 support — standard btoa() fails on characters outside the Latin-1 range; this tool encodes text through TextEncoder first, making Japanese, Arabic, emoji, and other non-ASCII characters encode and decode correctly.
  • URL-safe Base64 mode — a checkbox toggles URL-safe encoding, which replaces + with -, / with _, and strips trailing = padding. The decoder automatically detects and normalizes URL-safe input whether or not the mode checkbox is active.
  • Real-time conversion — output updates automatically 300ms after you stop typing, so you do not need to click a button for simple conversions.
  • Copy result to clipboard — copies the output text using the Clipboard API, with a fallback for older browsers.
  • Download as text file — saves the output as encoded.b64 when encoding or decoded.txt when decoding.
  • Swap input/output — moves the current output into the input field and switches to the opposite mode (encode → decode or decode → encode) in one click.
  • Batch mode — processes multiple items one per line, displaying results in a table with per-row error reporting.

How to Use the Base64 Encoder/Decoder

Step 1: Choose Encode or Decode Mode

At the top of the tool, two buttons labeled "Encode" and "Decode" select the active mode. The currently active mode is highlighted. Below these buttons, a "URL-safe mode" checkbox controls whether output uses the URL-safe alphabet. Toggle it before or after entering text — the conversion reruns automatically when you change it.

Step 2: Enter Your Text

In Encode mode, the left panel is labeled "Text Input". Paste or type the text you want to encode. The character count updates live. In Decode mode, the left panel is labeled "Base64 Input". Paste a Base64 string here. The tool handles both standard Base64 (with +, /, and = characters) and URL-safe Base64 (with - and _) without requiring you to specify which format you are pasting.

Step 3: Read or Trigger the Output

Output appears in the right panel within 300ms of your last keystroke (the tool uses a debounced auto-convert). You can also click the main action button or press Ctrl+Enter / Cmd+Enter to convert immediately. The output field is read-only and shows the encoded or decoded result.

Example — encoding:

  • Input: Hello, World! 🌍
  • Mode: Encode, URL-safe: off
  • Output: SGVsbG8sIFdvcmxkISDwn4yN

Example — decoding:

  • Input: SGVsbG8sIFdvcmxkISDwn4yN
  • Mode: Decode
  • Output: Hello, World! 🌍

Step 4: Use the Output

Four action buttons appear below the input/output panels:

  • Swap / Switch Mode — takes the current output, puts it in the input field, and flips the mode. Useful when you have just encoded something and want to verify decoding works correctly.
  • Copy — copies the output to your clipboard and shows a confirmation toast.
  • Download — saves the output as a file (encoded.b64 or decoded.txt depending on mode).
  • Clear — resets both input and output fields.

Step 5: Use Batch Mode for Multiple Items

Click the "Batch Mode" toggle to switch to batch processing. Enter one item per line in the batch input area. Click "Process All" to encode or decode every line using the current mode and URL-safe settings. Results appear in a table showing the original input, the processed output, or an error message for any line that fails. A "Copy All Results" button copies all output values joined by newlines.

Practical Examples

Encoding an API Credential for HTTP Basic Auth

HTTP Basic Authentication requires credentials in the format username:password encoded as Base64 and placed in the Authorization header. Enter myuser:s3cr3tpassword into the encoder and the result — for example bXl1c2VyOnMzY3IzdHBhc3N3b3Jk — goes directly into your header as Authorization: Basic bXl1c2VyOnMzY3IzdHBhc3N3b3Jk. Because Basic Auth credentials contain only ASCII characters, URL-safe mode is unnecessary here.

Decoding a Base64-Encoded JSON Payload

When debugging an OAuth or SAML token, you often need to read a Base64-encoded JSON blob embedded in a response. Paste the encoded string into the decoder. If the string uses URL-safe encoding (common in JWT payloads where . separates segments), the tool auto-detects the - and _ characters and normalizes them before decoding, so you do not need to manually convert the alphabet. The decoded JSON appears in the output panel and you can copy it for further inspection in a JSON formatter.

Batch Decoding Log Entries

Server logs sometimes contain Base64-encoded user inputs or tokens for security reasons. Switch to Batch Mode, paste the encoded log values one per line, and click "Process All". The results table shows each decoded value alongside the original, making it easy to scan for patterns or specific content without decoding each entry manually.

Tips and Best Practices

The decoder handles URL-safe input automatically. If a Base64 string contains - or _ characters, the decoder recognizes them as URL-safe Base64 and normalizes them to + and / before decoding, then re-adds the = padding as needed. You do not need to toggle the URL-safe checkbox when decoding — it is only relevant when encoding to control which alphabet the output uses.

Use URL-safe mode for tokens in query strings and cookies. Standard Base64 uses + (which URL-encodes to %2B) and / (which encodes to %2F) and may include = padding. Any of these can cause parsing issues in URL contexts. URL-safe mode removes all three problems.

Swap to verify a round-trip. After encoding, click "Swap / Switch Mode". The encoded output moves into the input as a decode target and the mode flips to Decode. Running the conversion should reproduce your original input exactly, confirming the encoding round-tripped correctly.

Ctrl+Enter is faster than clicking for repeated conversions. The keyboard shortcut Ctrl+Enter (or Cmd+Enter on Mac) triggers conversion immediately without waiting for the 300ms debounce or reaching for the mouse.

Common Issues and Troubleshooting

"Invalid Base64 string. Please check your input." — the input contains characters that are not valid in the Base64 alphabet after normalization. Common causes: extra whitespace inside the string (not at the edges — trimming is applied automatically), corrupted copy-paste that introduced invisible characters, or a string that is Base64URL without proper normalization. Check that the string contains only A-Z, a-z, 0-9, +, /, = (standard) or -, _ without padding (URL-safe).

Output appears correct but is shorter than expected. — if URL-safe mode is enabled during encoding, the = padding is stripped. Decoders that require padding will fail on this output. Toggle URL-safe mode off to include padding in the output.

Emoji and non-ASCII characters produce garbled output with other tools. — the tool encodes Unicode text through TextEncoder (UTF-8 bytes) before Base64-encoding. Some tools use btoa() directly on the raw string, which only handles Latin-1 characters. Ensure the target decoder also handles UTF-8 byte sequences rather than assuming Latin-1.

"Please enter text" — you clicked Convert or pressed the keyboard shortcut with an empty input field. Add text before converting.

Privacy and Security

The Base64 Encoder/Decoder runs entirely in your browser. Input text is processed using browser-native APIs (TextEncoder, btoa, atob, TextDecoder) with no network requests. Sensitive data such as passwords, API keys, or private tokens never leaves your device. The tool has no server component for encoding or decoding operations. It functions offline once the page has loaded in your browser.

Frequently Asked Questions

Is the Base64 Encoder/Decoder free? Yes. The tool is completely free with no account, no signup, and no usage limits.

Can I use it offline? Yes. Once the page has loaded, all encoding and decoding runs locally in your browser. No internet connection is required for the actual conversion.

Is my data safe to enter here? Yes. The tool makes no network requests for encoding or decoding. Your text stays in your browser tab. Do not use any online tool for encoding production secrets if you cannot verify the network behavior — this tool can be audited in browser DevTools (Network tab will show no outbound requests during conversion).

What is the difference between standard Base64 and URL-safe Base64? Standard Base64 uses + and / as the 62nd and 63rd characters, and pads output to a multiple of 4 characters with =. URL-safe Base64 replaces + with - and / with _, and omits the = padding. The URL-safe variant is safe to include in URLs, query parameters, and HTTP headers without percent-encoding.

Does the tool handle Unicode characters like Chinese or emoji? Yes. The encoder passes text through TextEncoder to produce UTF-8 bytes, then Base64-encodes those bytes. The decoder reverses this: it Base64-decodes to bytes, then passes them through TextDecoder to recover the original Unicode string. This correctly handles all Unicode characters.

What is the keyboard shortcut for converting? Press Ctrl+Enter on Windows/Linux or Cmd+Enter on macOS to trigger conversion immediately.

Can I encode a file to Base64? The text-mode tool encodes the text content of a string. To encode a binary file (like an image) to Base64, use a tool that accepts file uploads and reads the raw binary data. The current tool's input field accepts text only.

What does the Swap button do? The Swap button takes the current output, places it in the input field, and switches to the opposite mode. If you were encoding, you switch to decoding and vice versa. This is useful for quick round-trip verification.

How does Batch Mode work? Enter one item per line in the batch input textarea. Clicking "Process All" processes each line using the current mode (encode or decode) and URL-safe setting. Results appear in a table. Each row shows the original input and the processed output, or an error message if that line failed. You can copy all results at once with "Copy All Results".

Why does my Base64 string end without = signs? Either URL-safe mode was used during encoding (which strips padding), or the original data length happened to be a multiple of 3 bytes (which requires no padding). Both are valid. The decoder adds padding back as needed before decoding.

Related Tools

The JWT Encoder/Decoder uses Base64URL encoding internally for JWT header and payload segments. The URL Encoder/Decoder handles percent-encoding for query strings, complementing Base64 URL-safe encoding in web contexts. The JSON Formatter is useful for reading decoded Base64 payloads that contain JSON.

Try Base64 Encoder/Decoder now: Base64 Encoder/Decoder

Last updated: February 27, 2026

Keep Reading

More ArticlesTry Base64 Encoder/Decoder