URL Encoder / Decoder
URL encoding (percent-encoding) converts characters that cannot appear in a URL, or that have special meanings, into a %XX format where XX is the hexadecimal code of the character. This tool supports both encodeURIComponent (for query parameters) and encodeURI (for full URLs).
Encode and decode URLs (percent-encoding) instantly in your browser. Supports both encodeURIComponent and encodeURI. Handles Japanese, emoji, and all multibyte characters correctly.
Encodes everything except unreserved characters (A–Z, a–z, 0–9, - _ . ! ~ * ' ( )). Use this for individual query parameter values.
How to Use
Follow these steps to encode or decode a URL.
- Select "Encode" or "Decode" mode.
- In encode mode, choose the encoding method: use "encodeURIComponent" for query parameter values, or "encodeURI" to escape a full URL while preserving its structure.
- Paste your text (encode) or URL-encoded string (decode) into the input field.
- Click "Convert" to see the result.
- Use the Copy button to copy the result to your clipboard.
All processing happens locally in your browser. No input data is sent to any server.
What Is URL Encoding (Percent-Encoding)?
URL encoding, also known as percent-encoding, converts characters that are not allowed in a URL or that carry special meaning into a "%XX" format, where XX is the hexadecimal representation of the character's UTF-8 byte value. It is defined in RFC 3986 and is used to safely transmit characters such as Japanese text, spaces, and symbols in HTTP requests. For example, "日本語" becomes "%E6%97%A5%E6%9C%AC%E8%AA%9E".
JavaScript provides two encoding functions. encodeURIComponent encodes everything except unreserved characters (A–Z, a–z, 0–9, -, _, ., !, ~, *, ', (, )). It is the right choice when embedding a value as part of a URL, such as a query string parameter. encodeURI leaves URL structural characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) untouched so that the URL remains valid as a whole. Use it when you want to escape a complete URL without breaking its structure.
Decoding is done with decodeURIComponent, which restores %XX sequences to their original characters. This tool also handles the application/x-www-form-urlencoded convention of using "+" to represent a space, automatically replacing "+" with a space before decoding.
Why Does a Space Become "+"?
In the early days of HTML forms, MIME (Multipurpose Internet Mail Extensions) was the dominant standard for transferring data. One MIME encoding scheme called quoted-printable represented spaces as "+", apparently because trailing spaces could be silently stripped by mail servers. This convention seems to have been carried over when the form data encoding spec was written.
RFC 1866 (HTML 2.0), published in 1995, formally adopted this habit. The form submission format application/x-www-form-urlencoded specifies that spaces should be encoded as "+".
RFC 3986 (the URI standard), published in 2005, defines "+" as a literal plus sign — not a space. So two conflicting conventions coexist on the web: "+" means space in form-encoded contexts, and "+" means "+" in standard URI contexts. Which one applies depends on context.
This shows up in practice today. JavaScript's encodeURIComponent() encodes a space as "%20", while URLSearchParams encodes it as "+". In PHP, urlencode() produces "+" and rawurlencode() produces "%20". The same space character ends up looking different depending on which tool you use — apparently because of decisions made in the early days of the web.
The "20" in %20 Is an ASCII Code
The two hex digits after "%" in a percent-encoded URL represent the UTF-8 byte value of the character in hexadecimal. A space is ASCII code 32, and 32 in hex is 20 — hence "%20". "!" is ASCII 33 → 21 in hex → "%21". "#" is ASCII 35 → 23 → "%23", and so on.
ASCII (American Standard Code for Information Interchange) was defined in 1963. Values 0–31 are control characters (newline, tab, etc.) and 32–126 are printable characters. The space sitting at position 32 — the first printable slot — is said to reflect the design of typewriters, where the spacebar moved the print head one character width without leaving a mark.
ASCII only covers 128 characters, so Japanese is out of scope. UTF-8, which came later, represents Japanese kanji, hiragana, and katakana using three bytes per character. Since each byte becomes a "%XX" triplet, one Japanese character turns into nine encoded characters — which is why "日本語" (three characters) expands to 27 when encoded.
"日" has UTF-8 bytes E6, 97, A5, which encode to "%E6%97%A5". "本" encodes to "%E6%9C%AC" and "語" to "%E8%AA%9E". So the full encoding of "日本語" is "%E6%97%A5%E6%9C%AC%E8%AA%9E".
Use Cases: Where URL Encoding Appears
URL encoding is a fundamental part of web development and appears in many everyday tasks. Understanding it helps you avoid common bugs such as double-encoding or choosing the wrong encoding function.
- Building Search Query Parameters
- When a user types Japanese or special characters into a search box, the browser automatically URL-encodes the input before sending it. When constructing URLs manually in code, you must call encodeURIComponent yourself — for example, turning "?q=Hello World" into "?q=Hello%20World". Spaces become "%20" (or "+" in form submissions).
- API Request URL Parameters
- When passing values containing special characters as path or query parameters in a REST API, failing to encode them with encodeURIComponent can cause "/" or "?" to be interpreted as URL delimiters, routing the request to the wrong endpoint. Use this tool to preview the encoded form of a value before embedding it in code.
- Creating mailto Links and Social Share URLs
- The subject and body fields in mailto: links, as well as text parameters in social media share URLs, must be URL-encoded. For example, "subject=Contact Us" should be written as "subject=Contact%20Us". Paste your text here, copy the encoded result, and drop it straight into your HTML or template.
- Reading Server and Access Logs
- Web server access logs record request paths in their URL-encoded form. Sequences like "%E3%83%86%E3%82%B9%E3%83%88" are hard to read at a glance. Paste them into this tool to instantly see the original characters — no command-line tools required.
- Debugging OAuth and JWT Authentication Flows
- OAuth 2.0 authorization requests include URL-encoded parameters such as redirect_uri and scope. When debugging an authentication flow, decoding the URL shown in the browser address bar lets you quickly inspect these values. Decoding error codes returned in callback URLs also helps pinpoint the root cause of failures.
URL encoding is one of the foundations of the web. Common pitfalls include double-encoding (encoding an already-encoded string a second time) and using encodeURI where encodeURIComponent is needed, or vice versa. Use this tool to verify the output at each step and catch these mistakes before they reach production.
Frequently Asked Questions
- Can I encode Japanese text or emoji?
- Yes. This tool uses JavaScript's encodeURIComponent and encodeURI, which convert text to UTF-8 bytes before percent-encoding each byte. Japanese, Chinese, Korean, emoji, and all other multibyte characters are handled correctly.
- What is the difference between encodeURIComponent and encodeURI?
- encodeURIComponent encodes everything except unreserved characters (letters, digits, and - _ . ! ~ * ' ( )), making it safe for embedding values inside a URL. encodeURI leaves the structural characters of a URL (: / ? # [ ] @ and others) unencoded so the URL stays valid. Use encodeURIComponent for individual parameter values and encodeURI when you need to escape a full URL.
- Is my input sent to a server?
- No. All encoding and decoding is performed locally in your browser using JavaScript. Sensitive data can be processed safely.
- Why does decoding fail?
- Decoding fails when the %XX sequence contains characters that are not valid hexadecimal digits, or when a multibyte sequence is incomplete. This tool also treats "+" as a space (application/x-www-form-urlencoded convention). If you still see an error, double-check that the input is a correctly percent-encoded string.
Base64 Encode / Decode
We also provide a Base64 encoder/decoder for converting binary or text data to and from Base64 format. URL-safe Base64 is supported too.