About this tool
Encoding transforms data into a specific format for transport or storage without changing its meaning, while decoding restores the encoded content to its original form. Encoding is commonly used to handle character-set compatibility, escape special characters, and carry binary data through text-based protocols.
This tool supports Base64, URL-safe Base64, URL percent-encoding, HTML entities, Unicode escapes, hexadecimal and binary. Conversions happen instantly in your browser, and nothing you type is ever uploaded to a server.
Percent-encoding works on bytes, not on characters, and that single fact explains most confusion. A browser first converts the text to UTF-8, then writes each byte that is not allowed in a URL as a percent sign followed by two hexadecimal digits. The character 中 becomes three bytes, E4 B8 AD, and therefore the nine-character sequence %E4%B8%AD. Spaces are the classic exception: the URL standard says %20, while HTML form submission encodes a space as +, so a value copied from a query string can legitimately contain either. And when a string has been encoded twice — often because both a client and a proxy escaped it — a literal percent sign becomes %25 and the visible result is %2520 for a single space. That signature is the quickest way to recognise double encoding.
Base64 is a transport format, not a security feature. It maps three bytes onto four characters from a 64-symbol alphabet, which is why the output is about a third larger than the input, and pads the final group with one or two equals signs so the length stays a multiple of four. The URL-safe variant replaces + and / with - and _ and usually drops the padding, because those characters are safe inside a path segment or a JWT. MIME base64 wraps lines at 76 characters for email, and a decoder that rejects a long single line is often complaining about missing line breaks rather than bad data. Anyone can reverse the encoding in a second, so Base64 must never be used to hide a password, a token or personal data.
The remaining formats solve narrower problems. HTML entities replace characters that would otherwise be read as markup — &, <, >, " — and are decoded once by the browser; decoding twice turns &lt; into <, which is how escaped text suddenly becomes live markup. Entity encoding is not, by itself, protection against cross-site scripting, because safety depends on the context: an attribute needs quoting, a script block needs a different escaping rule, and a URL attribute needs scheme validation. Unicode escapes such as \u4e2d express a code point in ASCII, which is useful inside JavaScript and JSON string literals; characters outside the basic plane, including emoji, need a surrogate pair. Hexadecimal and binary modes expose the raw UTF-8 bytes, which is the right view when you are checking a checksum, a bit mask or a protocol frame.
Garbled output, the classic 锟斤拷 or mojibake, almost always comes from a charset mismatch rather than a broken tool: text encoded as UTF-8 and read as GBK, Windows-1252 or Latin-1 produces exactly that pattern. Double encoding and byte-order marks cause similar symptoms. If a decode operation reports that it cannot convert, check that the input really belongs to the selected format before retrying — a Base64 string with a stray space, a percent escape cut in half, or hexadecimal with an odd number of digits will all fail, and the error is telling you the truth.
How to use
- Encoding type: choose the format to use, such as Base64, URL encoding or HTML entities.
- Direction: choose “Encode” to convert raw content into that format, or “Decode” to restore it.
- Input: type or paste content into the left pane — the converted result appears on the right in real time.
- Swap: move the current output back into the input pane and flip the direction, which is handy for checking a round trip.
- Result: copy it to the clipboard, download it as a text file, or clear both panes and start again.
- Identify the layer first: escaping for a URL, an HTML document, a JSON string and a binary transport each follow different rules, and applying two layers of the same rule produces double-encoded output such as %2520.
- Verify with a round trip: encode the value, decode the result and compare it byte for byte with the original. If they differ, something upstream was already encoded or the wrong charset was assumed.
Frequently asked questions
Is my input uploaded to a server?
No. All encoding and decoding happens locally in your browser with JavaScript. No network request is made, and the content disappears as soon as you close or refresh the page.
What is the difference between Base64 and URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe variant replaces them with - and _ and removes the trailing = padding, so the result can be safely placed in a URL or a file name.
Why do I get a “cannot convert” error when decoding?
It usually means the input does not match the selected encoding type — for example decoding text that is not Base64 as Base64, a hex string with an odd number of digits, or URL encoding with an incomplete percent escape. Double-check the type and the input.
What is a Unicode escape?
A Unicode escape represents a character as \uXXXX, for example 中 becomes \u4e2d. It is often used to embed text in environments that do not support certain characters, or as string literals in JavaScript and JSON.
How do hexadecimal and binary encoding differ?
Both first convert the text to UTF-8 bytes and then represent each byte: hexadecimal uses two 0-9a-f characters per byte, while binary uses eight 0/1 bits. Binary output is longer but shows every bit explicitly.
Why do I see both %20 and + for spaces?
They come from two different rules. encodeURIComponent and the URL standard produce %20, while HTML form submission and the application/x-www-form-urlencoded format encode a space as +. When decoding, treat + as a space only in query-string context; inside a path a + is a literal plus sign.
Is Base64 a form of encryption?
No. It is a reversible encoding with no key, and anyone can decode it instantly. Use it to carry binary data through text-only channels such as JSON, email or a data URI. For confidentiality you need real encryption, and for integrity a signature or a hash.
Why does Base64 end with one or two equals signs?
The encoder processes three bytes at a time and produces four characters. When the input length is not a multiple of three, the last group is padded with = so the output length stays divisible by four. URL-safe Base64 usually omits this padding, and most decoders accept either form.
Why does Chinese or Japanese text turn into gibberish after decoding?
The bytes were interpreted with the wrong character set. UTF-8 text read as GBK, Shift-JIS or Latin-1 produces the familiar mojibake pattern, and double encoding or a byte-order mark can look similar. Confirm that the source is UTF-8 and that the value has been encoded exactly once.
What is double encoding and how do I fix it?
It means the same escaping was applied twice, so a space became %20 and then %2520 because the percent sign itself was escaped. Decode once to get back to %20 and once more to reach the original space. The durable fix is to encode exactly once, at the boundary where the value leaves your system.
Do HTML entities make user input safe?
Not on their own. Entity encoding protects text inserted into an element body, but an attribute needs correct quoting and a URL attribute needs scheme validation, and a script context needs its own escaping. Use a templating engine or an API that escapes for the specific context instead of relying on one global conversion.