Base64 encode / decode

Base64 encode / decode

Convert UTF-8 text to and from Base64, standard or URL-safe

Computed in your browser

Paste text and choose Encode, or paste Base64 and choose Decode. Enable URL-safe format when handling Base64URL.

 

Example

Input

Hello

Example result

SGVsbG8=

Standard mode keeps the trailing =; URL-safe mode produces SGVsbG8.

Technical details & limits

Standard Base64 maps each three bytes to four six-bit symbols and uses trailing = padding. Base64URL replaces + and / with - and _. This tool operates on UTF-8 bytes and ignores ASCII whitespace when decoding. Bytes that are not valid UTF-8 are reported as binary, not a successful text result.

About this tool

Encode UTF-8 text as standard Base64 or Base64URL and decode it back to text. Inspect encoded API fields, create test fixtures and diagnose Unicode encoding, with byte and character counts shown locally.

Use cases

  • Inspect Base64 text fields inside JSON or configuration.
  • Carry strings with newlines or quotes through a config file safely.
  • Decode a base64 field that showed up in a log to see the original payload.
  • Inspect JWT Base64URL fields. HTTP Basic authentication uses standard Base64.

How to use

  1. Paste the text (or Base64) into the input box.
  2. If your target uses the URL-safe variant (+/ → -_, no = padding), enable URL-safe.
  3. Click Encode or Decode. Copy the result from the output field.

Input & output

Input
UTF-8 text, or a valid Base64 / Base64URL string.
Output
A Base64 string, or decoded UTF-8 text.
Limits
Text only, with no binary-file export. Large inputs depend on browser memory and device performance; split them into smaller pieces.

Notes

A binary-data message means the decoded bytes are not valid UTF-8. Handle those bytes with a local file utility.

FAQ

Why does decoding fail?
Check the alphabet, padding position and UTF-8 content. ASCII whitespace is ignored. Enable URL-safe for Base64URL; arbitrary binary bytes may not decode as UTF-8 text.
What is the difference between Base64 and Base64URL?
URL-safe swaps `+` for `-`, `/` for `_`, and drops the trailing `=` padding. That lets the string live inside a URL without percent-encoding.
Is Base64 encryption?
No. Anyone can decode it in a second. Do not use it to protect secrets.
Why does the encoded output grow?
Base64 uses 4 characters per 3 bytes — about 33% overhead. Exact length is `4 × ⌈n/3⌉`.
Why can I not restore an image from email Base64 here?
Email data may include line breaks, MIME headers or binary attachments. This is a text tool, not a file downloader. Remove MIME headers first and use a local file utility for non-UTF-8 bytes.
Why does the number of padding characters vary?
Standard Base64 groups three bytes at a time and uses one or two trailing = characters for an incomplete group. This tool omits padding in Base64URL output and restores it when decoding.

Related tools

Base64 encode / decode · Convert UTF-8 text to and from Base64, standard or URL-safe
Base64 encode / decode — Tool illustration · dayeku.com