Base64 Encoder
Convert plain text or binary strings to Base64-encoded output. Supports standard and URL-safe alphabets per RFC 4648, and handles full UTF-8 including emojis and non-Latin scripts.
Base64 adds roughly 33% to data size. That tradeoff exists because binary data needs to survive text-only channels like email headers, JSON payloads, and HTTP Authorization headers. Defined in RFC 4648, Base64 uses a 64-character alphabet: A-Z, a-z, 0-9, plus + and / (or - and _ in URL-safe mode). This browser-based encoder processes your input entirely on your device using the built-in btoa() and TextEncoder APIs. Private strings, tokens, and credentials are never sent to any server.
How to Encode to Base64
- Type or paste the text you want to encode into the input field.
- Select Standard or URL-safe encoding mode.
- The encoded Base64 output appears instantly in the output panel.
- Click Copy to copy the result to your clipboard.
How Base64 Encoding Works
The 64-Character Alphabet
Base64 uses a 64-character alphabet: A-Z (26), a-z (26), 0-9 (10), and two additional characters. Standard Base64 (RFC 4648 Β§4) uses + and /. URL-safe Base64 (RFC 4648 Β§5) replaces those with - and _. The encoding takes three input bytes (24 bits), splits them into four 6-bit groups, and maps each 6-bit value to the corresponding alphabet character. This is why Base64 output length is always a multiple of 4.
Padding
Because Base64 processes data in 3-byte groups, input lengths that are not multiples of 3 require padding. One leftover byte produces == at the end. Two leftover bytes produce =. Padding is required in standard Base64 but is often stripped in URL-safe implementations, particularly JWTs.
Example
Input
Hello, World!
Output (Standard Base64)
SGVsbG8sIFdvcmxkIQ==
The two = padding characters appear because "Hello, World!" is 13 bytes β 13 mod 3 = 1, so one byte is left in the final group.
Common Use Cases
- HTTP Basic Authentication β
Authorization: Basicheaders requireusername:passwordencoded in Base64 - Inline images in HTML/CSS β Data URIs:
data:image/png;base64,iVBORw0KGgo... - JWT tokens β The header and payload sections use URL-safe Base64
- Email attachments β MIME (RFC 2045) uses Base64 to encode binary attachments in text-based email protocols
Standard vs URL-Safe Base64
Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces them with - and _, making the output safe in URLs, filenames, and query parameters without percent-encoding. Use URL-safe mode for JWTs, OAuth tokens, and any Base64 data appearing in URLs. To decode the output, use the Base64 Decoder. For embedding encoded data in URL query parameters, combine this tool with the URL Encoder.
Frequently Asked Questions
Is Base64 a form of encryption?
No. Base64 is an encoding scheme, not encryption or any form of security. Anyone with the Base64 string can decode it instantly without a key. It provides zero confidentiality. Use AES-256 or RSA if you need to protect data β Base64 is for safe transport of binary data in text channels, not for hiding information.
Why does Base64 output always end with == or =?
Base64 encodes data in groups of 3 bytes into 4 characters. When input length is not divisible by 3, the final group has 1 or 2 bytes instead of 3. One leftover byte produces == padding; two leftover bytes produce =. Padding ensures output length is always a multiple of 4, as required by RFC 4648.
Does this encoder handle Unicode and emojis correctly?
Yes. The encoder first converts text to UTF-8 bytes using the browser's TextEncoder API before applying Base64. Unicode characters including emojis (4 bytes in UTF-8), Chinese characters, Arabic letters, and accented Latin characters are all encoded correctly and decode back to the original text.
What is URL-safe Base64 and when should I use it?
URL-safe Base64 (RFC 4648 Β§5) replaces + with - and / with _. Use it whenever Base64 data appears in a URL, filename, cookie, or HTTP header where the standard characters would be misinterpreted. JWT tokens, OAuth access tokens, and PKCE code verifiers all use URL-safe Base64.
By how much does Base64 increase data size?
Base64 encoding increases data size by exactly 33.33% β 3 input bytes become 4 output characters (4/3 = 1.333...). Additionally, the output may include up to 2 padding characters. For large binary payloads, multipart or binary protocols are more bandwidth-efficient than Base64.