URL Encoder & Decoder — Encode URL Online
URLs can only safely contain a limited set of characters, so anything else — spaces, &, ?, =, non-English letters — has to be “percent-encoded” into a %XX form (a space becomes %20). Get this wrong and a link or an API call quietly breaks. This tool encodes text into URL-safe form and decodes it back, so you can build and debug query strings and links with confidence.
How to use
Choose a mode using the Encode / Decode toggle:
- Encode — convert plain text or a raw URL into a percent-encoded form.
- Decode — convert a percent-encoded string back to human-readable form.
Choose the scope using the Full URL / URI Component toggle:
- Full URL — uses JavaScript's
encodeURI(), which preserves URL structural characters (://,/,?,&,=,#). - URI Component — uses
encodeURIComponent(), which encodes everything except letters, digits, and-_.!~*'().
- Full URL — uses JavaScript's
Paste your input into the text area and click the run button.
The encoded or decoded output appears in the output card. Click Copy to copy it to the clipboard.
How it works
The tool delegates directly to the browser's built-in JavaScript functions:
encodeURI(input)— encodes a complete URL, safe for use in an<a href>attribute.encodeURIComponent(input)— encodes a value for embedding inside a query string.decodeURI(input)— reversesencodeURI.decodeURIComponent(input)— reversesencodeURIComponent.
No server round-trip is needed. Processing happens entirely in your browser — your input is never sent anywhere.
Worked example 1: encoding a search query
You want to build a URL that passes a search term as a query parameter:
Base URL: https://example.com/search
Parameter: q=hello world & lang=en
Using URI Component mode on the parameter value only:
| Input | Encoded |
|---|---|
hello world |
hello%20world |
Full URL becomes: https://example.com/search?q=hello%20world&lang=en
Worked example 2: encoding a URL to pass as a parameter
You are building a redirect URL and need to pass the destination URL as a query parameter:
Original destination: https://example.com/path?q=test#section
Using URI Component mode on the full destination URL:
| Input | Encoded |
|---|---|
https://example.com/path?q=test#section |
https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dtest%23section |
This gives you: https://mysite.com/redirect?to=https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dtest%23section
If you had used Full URL mode on the destination, the ://, /, ?, and # would not be encoded — the resulting URL would break the outer query string parser.
Characters and their encoded forms
| Character | Percent-encoded | Context |
|---|---|---|
| Space | %20 |
Everywhere |
& |
%26 |
Query param values |
= |
%3D |
Query param values |
# |
%23 |
Query param values |
? |
%3F |
Query param values |
+ |
%2B |
Query param values |
/ |
%2F |
URI Component only |
: |
%3A |
URI Component only |
@ |
%40 |
URI Component only |
[space] (form) |
+ |
HTML form encoding |
Tips
- Always encode query parameter values with URI Component — not Full URL. Full URL mode leaves
&,=, and#unencoded, which will break the query string if those characters appear in your value. - Decode before re-encoding to avoid double-encoding (
%20becoming%2520). Paste the encoded string into Decode mode first to check it. - Non-ASCII characters are safe. The tool handles emoji, Hindi, Arabic, Chinese, and any other Unicode input correctly through UTF-8 encoding.
- Check for stray + signs when debugging. If you are receiving a URL from a form submission and a space appears as
+instead of%20, use a form-aware decoder (decodeURIComponent after replacing+with spaces).
Worked example 3: encoding non-ASCII (Hindi text)
You need to pass a Hindi search term नमस्ते as a query parameter.
Using URI Component mode:
Input: नमस्ते
Encoded: %E0%A4%A8%E0%A4%AE%E0%A4%B8%E0%A5%8D%E0%A4%A4%E0%A5%87
The browser (via encodeURIComponent) first converts each Unicode character to its UTF-8 byte sequence, then percent-encodes each byte. The character न (U+0928) encodes to the three bytes E0 A4 A8, producing %E0%A4%A8. This is the correct way to embed any non-ASCII text in a URL — it works identically for Hindi, Arabic, Chinese, emoji, or any other Unicode content.
Full URL becomes: https://example.com/search?q=%E0%A4%A8%E0%A4%AE%E0%A4%B8%E0%A5%8D%E0%A4%A4%E0%A5%87
Modern browsers display internationalised URLs decoded in the address bar for readability, but the underlying request always uses the encoded form.
Common mistakes
Double-encoding. If you encode a string that is already encoded, %20 becomes %2520 — the % sign itself gets encoded as %25. This produces broken URLs. Before encoding, decode the string first to check if it already contains percent-sequences. The tool's Decode mode helps you inspect an existing value before re-encoding.
Using Full URL mode on a query parameter value. Full URL mode preserves &, =, and # — the characters that delimit query parameters. Encoding price=100¤cy=INR with Full URL mode produces price=100¤cy=INR (unchanged), which the URL parser will split into two separate parameters. Use URI Component on each value individually, then assemble: price=100¤cy=INR → price%3D100%26currency%3DINR only if this entire string is itself a value inside another URL.
Form encoding vs RFC 3986. HTML forms using method="GET" submit values using application/x-www-form-urlencoded encoding, where spaces become + instead of %20. If your server-side code uses a form decoder and you send %20, it may be received as a literal %20 string. Conversely, if you send + to a URI Component decoder, the plus sign is treated as a literal +. Match encoding to decoding: for form submissions use form encoding; for URL construction use RFC 3986 percent-encoding (%20).
Sources
- RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax
- WHATWG URL Standard — url.spec.whatwg.org
- MDN Web Docs — encodeURIComponent()
Last updated: October 2026
Frequently Asked Questions
- What is URL encoding?
- URL encoding (percent-encoding) converts characters that are not safe in a URL — such as spaces, &, =, #, and non-ASCII letters — into a %XX hexadecimal form. For example, a space becomes %20 and & becomes %26.
- What is the difference between encodeURI and encodeURIComponent?
- encodeURI encodes a complete URL and preserves characters that have special meaning in URL structure: : / ? # [ ] @ ! $ & ' ( ) * + , ; =. encodeURIComponent encodes everything except letters, digits, and - _ . ! ~ * ' ( ). Use encodeURIComponent for individual query parameter values.
- When should I use Full URL mode versus URI Component mode?
- Use Full URL (encodeURI) when encoding a complete URL that you want to keep structurally intact. Use URI Component (encodeURIComponent) when encoding a value that will appear inside a query string — for example, a URL that you are passing as a parameter to another URL.
- Why does encoding a space give %20 sometimes and + other times?
- The %20 form comes from standard percent-encoding (RFC 3986). The + form comes from HTML form encoding (application/x-www-form-urlencoded). Both represent a space. Most modern APIs accept %20; use it unless the specific system requires +.
- Can encoding fail?
- Decoding can fail if the input is malformed — for example, a % sign that is not followed by two valid hex digits. The tool displays the error message from the JavaScript runtime in that case.
- Does the tool handle Unicode characters?
- Yes. JavaScript's encodeURI and encodeURIComponent first convert each character to its UTF-8 byte sequence, then percent-encode each byte. For example, the Hindi character क encodes to %E0%A4%95.
- Is there a size limit on the input?
- There is no enforced limit. Processing happens in your browser, so the practical limit is the memory available in your browser tab. For very large strings (megabytes), processing may be slow.