About the Character Encoding
Type some text and get it back in three encoded forms at once: Base64, URL encoding (percent-encoding) and hex codes. Reach for it when text has to go into a URL, an API request, a config file or a data URI, and a stray space or an é would otherwise break it on the way.
All three results update as you type or paste. Each one is built from the text's UTF-8 bytes, which is why accented letters, Urdu, Arabic and emoji come through correctly. Everything is worked out in your browser.
How the text is encoded
First the text is turned into UTF-8 bytes with the browser's TextEncoder. Base64 then packs those bytes three at a time into four characters from the set A-Z, a-z, 0-9, + and /, adding = signs at the end when the byte count isn't a multiple of three. So Base64 always comes out about a third longer than the original.
URL encoding uses the browser's encodeURIComponent: letters, digits and the marks - _ . ! ~ * ' ( ) stay as they are, and every other byte becomes a % followed by two hex digits. A space becomes %20, a comma %2C and é becomes %C3%A9 (its two UTF-8 bytes).
On the Hex line you get each UTF-8 byte as two hexadecimal digits, separated by spaces. For plain English text that is one byte per character, the same as its ASCII code (H is 48, a space is 20); é gives two bytes, c3 a9, and an emoji such as 😀 gives four.
Base64 length = 4 × ceil(UTF-8 bytes ÷ 3) URL encoding = unreserved characters kept, every other byte → %XX Hex = each UTF-8 byte as two hex digits
Assumptions and limits
- It encodes only. To turn Base64 or a %-encoded string back into text, use Base64 Encode/Decode or URL Encode/Decode.
- The Hex line shows UTF-8 bytes, not Unicode code points. They match for ASCII, but é (code point U+00E9) appears as c3 a9, its two UTF-8 bytes.
- The output uses standard Base64 with + and /. For URL-safe Base64 (- and _ and no padding), swap those characters yourself.
- URL encoding here is for a single value, such as one query parameter. Encoding a whole URL this way also turns : and / into %3A and %2F.
- Line breaks are encoded too: a new line becomes %0A in the URL line and adds 0a to the Hex line.
- A broken half of an emoji (a lone surrogate, sometimes left behind when text is cut mid-character) can't be stored in UTF-8, so it's encoded as the replacement character �, bytes ef bf bd.
Worked examples
The sample text: Hello, World! 2024
Eighteen ASCII characters give 18 bytes, and Base64 turns those into exactly 24 characters with no padding. On the URL line, only the comma and the spaces change.
Base64: SGVsbG8sIFdvcmxkISAyMDI0 URL Encoded: Hello%2C%20World!%202024 Hex: 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21 20 32 30 32 34
Accented text in a query string
café is four characters but five UTF-8 bytes, because é takes two. The URL and Hex lines both show those two bytes; the Base64 needs one = for padding.
Base64: Y2Fmw6k= URL Encoded: caf%C3%A9 Hex: 63 61 66 c3 a9
Characters that break URLs
a b&c=d has a space, an ampersand and an equals sign in it, and a query string treats each of those as meaningful. Once encoded, it can go after ?q= without being split into extra parameters.
URL Encoded: a%20b%26c%3Dd
Common characters in each encoding
URL and hex values shown are what this tool outputs.
| Character | URL encoded | Hex | Notes |
|---|---|---|---|
| Space | %20 | 20 | Some forms use + for a space; this tool uses %20 |
| ! (exclamation) | ! | 21 | Left as is by encodeURIComponent |
| & (ampersand) | %26 | 26 | Separates query parameters |
| = (equals) | %3D | 3d | Separates a parameter's name from its value |
| / (slash) | %2F | 2f | Encoded because this is for single values |
| % (percent) | %25 | 25 | Must be encoded or it starts a new escape |
| New line | %0A | 0a | Each line break is kept |
| é | %C3%A9 | c3 a9 | Two bytes in UTF-8 |
| 😀 | %F0%9F%98%80 | f0 9f 98 80 | Four bytes in UTF-8 |
How to use the Character Encoding
- Enter your text. Type in the Input box or paste text; the sample Hello, World! 2024 shows the format.
- Read the three lines. Output shows Base64, URL Encoded and Hex, updating as you type (Process runs it again).
- Copy the result. Copy takes all three labelled lines; select one line in the Output box to copy just that.
Frequently asked questions
What is the difference between Base64 and URL encoding?
Base64 rewrites every byte, while URL encoding only replaces the unsafe ones. Base64 uses a 64-character alphabet, so the result looks nothing like the original and is about a third longer. URL encoding leaves ordinary letters and digits readable and swaps the rest for %XX codes. Use Base64 for binary data or tokens, URL encoding for values in links.
Why does my Base64 end with = or ==?
Because the byte count isn't a multiple of three. Base64 works on groups of three bytes, and when the last group has only one or two, one or two = signs pad the output to a multiple of four characters. Hello, World! 2024 is 18 bytes, a multiple of three, so it has no padding; café is 5 bytes and gets one =.
How do I encode a space in a URL?
As %20, which is what this tool produces. HTML forms submitted with the GET method use + for spaces in the query string instead, and many servers accept both, but %20 works in every part of a URL, including the path.
Does this support UTF-8 text such as Urdu, Arabic or emoji?
Yes. All three lines are made from the UTF-8 bytes, so 😀 becomes 8J+YgA== in Base64, %F0%9F%98%80 in URL encoding and f0 9f 98 80 in hex. Urdu and Arabic letters take two bytes each, so their hex is twice as long as the text.
Is Base64 a form of encryption?
No. Base64 only changes how bytes are written down, and anyone can decode it instantly. Don't rely on it to hide passwords or personal data. Its job is carrying text safely through systems that expect plain ASCII, such as email headers or JSON fields.
This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.