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 Base64 encoding make text longer?
Standard Base64 encodes each group of 3 bytes as 4 characters, which usually increases the text length. A final group containing 1 byte needs 2 padding signs, while a group containing 2 bytes needs 1. Measure the original data as UTF-8 bytes, rather than visible characters. Chinese text and other non-ASCII characters can occupy several bytes each before the Base64 encoding begins.
How does Base64URL decoding differ from standard Base64?
Base64URL replaces the plus and slash characters used by standard Base64 and may omit trailing padding. This tool restores 1 or 2 missing equals signs when needed for decoding. Select the URL-safe option for this variant and confirm which alphabet the source uses. Mixing the alphabets can cause validation errors, and successfully decoding bytes still does not guarantee that those bytes contain valid UTF-8 text.
Which character encoding does the Base64 decoder use for Chinese text?
This decoder interprets decoded bytes as UTF-8 text, so it cannot directly recover Chinese text stored in a different character encoding. A common Chinese character uses 3 UTF-8 bytes, while an ASCII letter uses 1. Confirm the original encoding before troubleshooting unreadable output. Arbitrary binary data may be valid Base64 but invalid UTF-8, and repeatedly decoding it does not repair the original encoding mismatch.

Related tools

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