Skip to content
ToolForge
Developer Tools

URL Encoder and Decoder

Free URL encoder and decoder. Percent-encode or decode strings, build query strings from parameters, and inspect a URL into its protocol, host, path, query and fragment parts.

Free, no sign-upRuns in your browserNothing uploaded

Encoded

Output, read only.

Which encoding should I use?

encodeURIComponent
Escapes everything reserved, including / ? & = #. Use this for a single value going into a query string or a path segment.
encodeURI
Leaves reserved characters alone because they define the URL structure. Use this for a whole URL you are building.
form-urlencoded
Identical to encodeURIComponent except a space becomes +. This is what HTML form submission uses.

URL encoding replaces characters that are not allowed in a URL with a percent sign followed by two hexadecimal digits. A space becomes %20, an ampersand becomes %26, a slash inside a query value becomes %2F. It exists so arbitrary text - including your own ampersands and question marks - can travel inside a URL without being mistaken for URL structure.

This tool offers the three encodings that are easy to confuse. encodeURI escapes a whole URL but deliberately leaves reserved characters alone, so it is right for a link you are building. encodeURIComponent escapes everything reserved, so it is right for a single value inside a query string. The application/x-www-form-urlencoded encoding used by HTML forms is subtly different again, turning spaces into + instead of %20.

There is also a URL inspector that breaks any link into its protocol, host, port, path, query parameters and fragment, with every component decoded as well as raw. That is how you find the tracking parameters you did not know a link had, or why two apparently identical URLs are not equivalent.

URL Encoder & Decoder features

All three encodings
encodeURI, encodeURIComponent and application/x-www-form-urlencoded, with a table explaining exactly which characters each one leaves untouched.
Character reference table
Shows the encoded form of every reserved and unsafe character, plus what the decoded character actually is.
URL inspector
Decomposes a URL into scheme, host, port, path, query parameters and fragment, showing each both raw and decoded.
Query string builder
Build a correctly encoded parameter list from key and value rows, with repeatable and empty-value support.
Useful presets
One click for encoding a full URL, a query value, a path segment, a cookie or a JSON string.
Double encoding warning
Flags the common bug of encoding an already-encoded string, which turns %20 into %2520.

How to use the URL Encoder & Decoder

  1. Pick a mode

    Encode, decode, or inspect. The encode and decode panels each have quick presets for whole URLs, query values, path segments and form bodies.

  2. Paste your string

    Output updates as you type. Pick between the encodeURI, encodeURIComponent and form-urlencoded behaviours, which differ on exactly the characters people trip over.

  3. Inspect a full URL

    The inspector shows scheme, host, port, path, each query parameter decoded and raw, and the fragment, plus a rebuilt canonical URL.

  4. Build a query string

    Add key and value rows and the tool generates the correctly encoded parameter string, ready to append to any endpoint.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI is for a whole URL and leaves reserved characters such as / ? & = # alone because they define the URL structure. encodeURIComponent escapes them too, which is what you want for one value inside a query string or path segment. Using the wrong one is why URLs end up with double-escaped slashes.

Should a space be %20 or +?

It depends on where you are. In a URL query, %20 is correct and safest. The + form is specific to application/x-www-form-urlencoded, which is what HTML form submission uses, and + only means space in that context. In a path segment it must always be %20.

How do I encode a JSON string for a query parameter?

Encode it as a single value with the form-urlencoded mode. JSON contains braces, quotes and colons, all of which are meaningful to a URL parser. You can also send JSON in a POST body with Content-Type: application/json, which is cleaner and has no length limit.

Why does my URL have %2520 in it?

That is double encoding: a %20 was encoded a second time into %2520. It happens when a value is encoded on the way in and then encoded again on the way out. Encode exactly once, at the boundary.

How long can a URL be?

Browsers and servers vary, but 2000 characters is the widely cited safe ceiling in Chrome and around 8000 before IE-style limits. Beyond roughly 2000 characters put the value in a POST body. If you need a genuinely long value, sign it and pass a reference.

Does encoding change the data?

No. It is a reversible representation of the same characters, chosen so a URL can carry them safely. Decoding the result returns exactly the original string, which you can confirm with the round-trip check.

Every tool, in one place

ToolForge has url encoder & decoder plus a growing set of image, colour and developer tools. All of them run locally in your browser, free and without an account.

Browse all tools