Base64 Encoder
Encode text or hex bytes to Base64 in your browser. Full UTF-8 support (emoji, CJK, accents), URL-safe alphabet, optional padding and 76-char wrap.
24 characters · 28 bytes (UTF-8)
0 characters · 0 bytes (UTF-8)
Runs entirely in your browser. Your data is never uploaded.
What is Base64 Encode?
Converts text into Base64 as defined in RFC 4648. The text is first turned into UTF-8 bytes, so emoji, Chinese, Arabic or Vietnamese characters encode correctly, and the bytes are then written with the 64-character Base64 alphabet. You can also paste raw bytes as hex instead of text.
How to use Base64 Encode
- Type or paste your text in Input (or switch Input format to Hex bytes to encode raw bytes).
- Optionally tick URL-safe alphabet (- and _), untick Add = padding, or enable Wrap lines at 76 characters (MIME).
- The Base64 result appears instantly in Output.
- Click Copy, or Use as input to switch to decoding and verify the round trip.
Example
Hello, World! Xin chào 👋
SGVsbG8sIFdvcmxkISBYaW4gY2jDoG8g8J+Riw==
Default options: UTF-8 input, standard alphabet with padding.
When to use Base64 Encode
Use Base64 when binary or non-ASCII data must travel through a text-only channel: JSON fields, data URIs, HTTP Basic auth headers, email (MIME) or configuration files. Do not use it to protect data – Base64 is an encoding, anyone can decode it – and avoid it for large files where the 33% size overhead matters (use the Base64 file encoder for files).
How Base64 Encode works
The input is converted to bytes (UTF-8 via TextEncoder, or parsed from hex). Every 3 bytes (24 bits) are split into four 6-bit groups, each mapped to one character of A–Z a–z 0–9 + /. If the last group has 1 or 2 bytes, the output is padded with = to a multiple of 4 characters. The URL-safe variant (RFC 4648 §5, "base64url") replaces + with - and / with _ and is usually used without padding. The 76-character wrap follows the MIME line-length rule.
Common Use Cases
- Building an HTTP
Authorization: Basicheader fromuser:password - Embedding a short string or token in JSON or YAML
- Creating base64url values for JWT headers and payloads
- Encoding non-ASCII text so it survives legacy ASCII-only systems
- Checking what bytes a UTF-8 string really produces
Security Note
Encoding happens locally in your browser; nothing is uploaded. Remember that Base64 offers no confidentiality.
FAQs
Why is my Base64 different from another tool for non-English text?
Some tools encode the text as Latin-1 or UTF-16. This tool always uses UTF-8, which is what browsers, btoa(unescape(encodeURIComponent(s))), Python base64.b64encode(s.encode()) and most APIs expect.
What is the difference between Base64 and base64url?
base64url uses - and _ instead of + and /, so the result can be placed in URLs and file names without percent-encoding. JWTs use base64url without = padding.
Is Base64 encryption?
No. It only changes the representation; anyone can decode it. Use real encryption (for example AES-GCM) if the data is secret.
How much bigger is Base64 output?
Four output characters for every three input bytes, so about 33% larger, plus line breaks if wrapping is enabled.