Encoding

URL Encoder / Decoder

Transform URLs with multiple encoding methods.

0 chars
Quick examples:
0 chars

Why Developers Need URL Encoding

Query Parameters: Safely encode values before adding them to URLs?search=hello world → ?search=hello%20world
API Requests: Ensure special characters don't break your fetch callsuser@example.com → user%40example.com
Unicode Support: Handle emojis and international characters properly😊 こんにちは → %F0%9F%98%8A%20%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF
React & JavaScript: Perfect for encodeURIComponent() and URL building

encodeURIComponent

Encodes all characters except: A-Z a-z 0-9 - _ . ! ~ * ' ( )

Best for encoding query parameters and path segments.

encodeURI

Encodes characters except: : / ? # [ ] @ ! $ & ' ( ) * + , ; =

Best for encoding complete URLs while preserving structure.

Form URL Encoded

Uses + for spaces instead of %20

Used for application/x-www-form-urlencoded form data.

Three encoding modes, and what each one actually leaves alone

This tool exposes three distinct encoding modes rather than one generic "URL encode" button, because the correct choice depends entirely on what you are encoding: a whole URL, a query parameter value, or form data destined for an HTML form post. Picking the wrong one either breaks the string it was meant to protect or leaves dangerous characters unescaped.

encodeURIComponent — the default — is the strictest of the three. It escapes every character except the unreserved set: uppercase and lowercase letters, digits, and the seven characters - _ . ! ~ * ' ( ). Everything else, including : / ? & = and space, is percent-encoded. That aggressiveness is exactly what you want for a value going inside a URL, such as a query parameter, because it guarantees the value can never be mistaken for URL structure.

encodeURI is the gentler mode, meant for encoding a complete URL rather than a fragment of one. It leaves the URL's own structural characters untouched — : / ? # [ ] @ ! $ & ' ( ) * + , ; = — so a full address like https://example.com/search?q=value keeps its scheme, slashes, and query separator intact. Only characters with no legitimate place in a URL, such as a literal space, get escaped.

Form URL encoding: the third, easily confused mode

The "Form URL Encoded" option produces application/x-www-form-urlencoded output — the format a browser generates when it submits an HTML form or builds a query string from form fields. It is built on encodeURIComponent's character set with one substitution: spaces become + instead of %20. Decoding reverses both directions: the tool first turns + back into a literal space, then runs decodeURIComponent on the result, so it correctly reads values written in either style.

The two space encodings are not interchangeable in every context. Standard URL paths and hand-written query values should use %20; only genuine form-post bodies and the query strings some frameworks build from form data use +. Pasting a +-encoded string into a browser address bar renders the plus sign literally, not as a space — that mismatch is one of the more common encoding bugs to chase down.

The real mistake this tool exists to prevent

The most common URL-encoding bug is encoding too much: running a whole URL through encodeURIComponent instead of encodeURI. Because encodeURIComponent escapes the colon and both slashes, https://example.com becomes https%3A%2F%2Fexample.com — a string that no longer works as a URL, only as a value that could be embedded inside one. The inverse mistake is just as common: encoding only a query parameter with encodeURI, which leaves & and = untouched, so a value containing either character silently truncates or corrupts the surrounding query string. Matching the mode to the payload — encodeURI for whole addresses, encodeURIComponent for the pieces inside them — is the entire discipline.

What happens outside the ASCII range

Non-ASCII text — accented letters, CJK characters, emoji — is encoded as its UTF-8 byte sequence, with every byte written as its own %XX triplet. A single emoji, which JavaScript represents as a UTF-16 surrogate pair, expands to four separate percent-encoded bytes once converted to UTF-8; a Japanese character expands to three. The visible string gets noticeably longer than the input — that is expected, not a sign of a bug, and decoding it exactly reverses the expansion.

One input, three outputs

Encoding https://example.com/search?q=hello world through all three modes shows the difference directly. encodeURIComponent produces https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world — every slash and colon escaped, unusable as an actual link but safe to embed as a value. encodeURI produces https://example.com/search?q=hello%20world — the address stays a working link, only the space inside the query value is escaped. The Form URL Encoded mode produces https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello+world — identical to the component mode except the space becomes a plus sign.

Parsing a URL into its components

When the input (or the decoded output) is a valid absolute URL, the tool parses it into protocol, hostname, port, pathname, query string, hash, and origin, and lists every query parameter as an individual key/value pair you can copy on its own. A color-coded bar above the breakdown marks each segment — protocol, host, path, query, hash — so a long URL's structure is visible at a glance instead of requiring you to count slashes and question marks by eye.

Common use cases

Encoding a query parameter for an API request

Run a user-supplied search term or filter value through encodeURIComponent before appending it to a request URL, so ampersands and spaces in the value can't be mistaken for query-string structure.

Debugging a URL that isn't parsing correctly

Paste the full address into the decoder and read the color-coded component breakdown — protocol, host, path, query, hash — to spot a stray character without counting slashes by eye.

Preparing form-post data

Switch to Form URL Encoded when building the body of an application/x-www-form-urlencoded submission, where spaces are expected as + rather than %20.

Turning an encoded value into a QR code

Send the current input or output straight to the QR code generator with one click, without retyping or re-copying it.

Frequently asked questions

What's the actual difference between encodeURIComponent and encodeURI?

encodeURIComponent escapes every character except letters, digits, and - _ . ! ~ * ' ( ) — including : / ? & = — so it's meant for a single value going inside a URL. encodeURI leaves those structural characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) alone, so it's meant for encoding an entire URL without breaking its own syntax.

Why does the output use + instead of %20 sometimes?

Only the Form URL Encoded mode does that — it matches application/x-www-form-urlencoded, the format browsers use for form submissions. The other two modes always use %20 for a literal space; a + in those modes is just a literal plus character.

I encoded my whole URL and now it doesn't work as a link — what happened?

encodeURIComponent was used on something that should have used encodeURI. Component encoding escapes the colon and slashes that make a URL a URL, turning https://example.com into an inert string rather than a working address. Switch modes and re-encode.

How does the tool handle emoji and non-English text?

It encodes the UTF-8 byte representation of each character, one %XX per byte — an emoji typically expands to four escaped bytes, an accented or CJK character to two or three. This is standard percent-encoding behavior, not a limitation of the tool.

Can I decode a string that mixes %20 and + for spaces?

Yes. Decoding first converts every + to a literal space, then runs decodeURIComponent on the result, so both encodings resolve correctly in the same pass.

What do the labeled fields below the input mean?

They are the URL's components as parsed by the browser's own URL API: protocol, hostname, optional port, pathname, query string, hash, and origin (protocol plus host combined), plus every query parameter broken out individually with its own copy button.

Does any of this get sent to a server?

No. Encoding, decoding, and URL parsing all run in your browser using JavaScript's built-in encodeURIComponent, encodeURI, and URL functions — nothing is transmitted anywhere.

Can I send the result straight to a QR code?

Yes — the QR from Input and QR from Output buttons hand the current text to the QR code generator directly, detecting whether it looks like a URL or plain text so the QR code is built with the right content type.

You might also like