Use the query string parser and builder when you need to split and edit a complete parameter list, including duplicate keys. This page focuses on correctly encoding or decoding one text layer.
Verifiable examples
In URL component mode, café and tea becomes:
caf%C3%A9%20and%20tea
In Form/query value mode, the same input becomes:
caf%C3%A9+and+tea
The difference is the space: generic percent-encoding uses %20, while
application/x-www-form-urlencoded uses +. Complete URL or path mode
preserves separators such as :, /, ?, &, =, and # so the address
keeps its structure.
Choose the mode that matches the input
Use URL component for a parameter value, filename, or isolated path segment. It preserves only RFC 3986 unreserved characters and escapes delimiters that would otherwise have structural meaning.
Use Complete URL or path after the address has been assembled. This mode
behaves like encodeURI and keeps its delimiters. It does not contact the
domain, follow a redirect, or prove that the URL is valid for a particular
application.
Use Form/query value when the receiver applies
application/x-www-form-urlencoded, as URLSearchParams and many HTML forms
do. Here, + decodes to a space. In component mode, + remains a literal plus
sign.
Exactly one encoding layer
Every operation handles one layer. Encoding %20 as a component escapes the
percent sign and produces %2520. Decoding once returns %20; decoding a
second time returns the space.
The interface warns when it sees an existing %HH sequence before encoding or
one left after decoding. That may indicate double encoding, but it is not
proof: an application may deliberately transport those characters as text.
Check the receiving format before removing another layer.
Use How to detect a double-encoded
URL for a repeatable procedure with
%2520, %252F, and nested parameters.
Validation and errors
- Every
%must be followed by two hexadecimal digits. - Percent-encoded bytes must form valid UTF-8.
- Component mode requires non-ASCII input to be encoded.
- An unpaired Unicode surrogate is rejected before encoding.
- Empty input and more than 1,000,000 characters are rejected.
- Decoding never repeats automatically.
URI malformed usually points to an incomplete percent sequence, a missing
UTF-8 byte, or an unpaired Unicode surrogate. Follow How to fix URI
malformed and compare the functions in
encodeURI vs encodeURIComponent.
Privacy and limits
All work happens in this tab. The input is not stored, added to the browser address, sent to Tools in a Tab, or included in a processing request. The tool does not sort query parameters, resolve domains, follow redirects, or validate an API-specific URL contract.
Frequently asked questions
Should I pass a complete URL to encodeURIComponent?
Usually not. It escapes :, /, ?, &, =, and #, which destroys the
address structure. Use complete URL mode for an assembled address and
component mode for one value.
Why does + sometimes mean a space?
That behavior comes from form serialization, not generic percent-encoding. Select the form/query mode only when it matches the source format.
Does the warning prove the value was encoded twice?
No. It means a string shaped like %HH already existed or remains after one
operation. Decide whether it represents another layer or literal text before
decoding again.
Technical references
URI components and reserved characters are defined in RFC 3986. Form serialization is specified by the WHATWG URL Standard.