AltUtils

URL Encoder / Decoder

Percent-encode and decode URLs and query strings, and break any URL into protocol, host, path and editable query parameters.

CategoryDev Core
Sheet16 / 42
ProcessingIn your browser

encodeURIComponent: escapes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use it for a single query value or path segment.

39 chars
84 chars

URL parser & query editor

Paste a URL to see how browsers split it (WHATWG URL standard) and edit its query parameters.

URL components
Protocolhttps:
Usernameuser
Passwordsecret
Hostexample.com:8080
Hostnameexample.com
Port8080
Pathname/docs/caf%C3%A9/index.html
Decoded: /docs/café/index.html
Search?q=hello+world&lang=en&tags=a%2Cb&redirect=https%3A%2F%2Fexample.org%2F
Hash#section-2
Originhttps://example.com:8080

Query parameters (4)

Spaces as
Rebuilt URL
https://user:secret@example.com:8080/docs/caf%C3%A9/index.html?q=hello+world&lang=en&tags=a%2Cb&redirect=https%3A%2F%2Fexample.org%2F#section-2

What is the URL Encoder & Decoder?

URLs may only contain a limited set of ASCII characters, so everything else — spaces, accented letters, emoji, and characters that have a special meaning such as & = ? # / — must be percent-encoded: each byte of the character's UTF-8 form is written as % followed by two hex digits. “é” becomes %C3%A9 and a space becomes %20 (or + in form data).

Which characters to escape depends on what you are encoding. Use Component mode (encodeURIComponent) for a single query value, path segment or a URL you want to pass as a parameter, because it escapes the separators & = / ? #. Use Full URL mode (encodeURI) to clean up a complete address without breaking its structure. Use Form mode for application/x-www-form-urlencoded bodies and URLSearchParams, where spaces are written as +.

Unlike JavaScript's decodeURIComponent, which throws “URI malformed” on the first bad sequence, this decoder keeps going: it decodes everything that is valid, leaves stray % signs untouched, replaces invalid UTF-8 with � and tells you the exact position of each problem. The URL parser uses the same WHATWG URL standard as your browser, so the protocol, host, port, path, query and fragment you see are exactly what fetch() or a link would use, and the query editor rebuilds a correctly encoded URL as you edit.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?
encodeURI is meant for a whole URL and leaves reserved characters such as : / ? # & = + intact so the URL keeps working. encodeURIComponent is meant for one piece of a URL and escapes those characters too, so a value like “a&b=c” cannot be mistaken for extra parameters.
Should spaces be encoded as %20 or +?
%20 is valid everywhere in a URL. The + sign only means a space in query strings and form bodies (application/x-www-form-urlencoded); in a path, + is a literal plus. When in doubt use %20 — decoders that expect + accept %20 as well.
Why do I get “URI malformed” errors elsewhere?
decodeURIComponent throws when it meets a % that is not followed by two hex digits (for example “100%”) or bytes that are not valid UTF-8 (such as text encoded as Latin-1, where é is %E9). This tool decodes around those spots and lists each one so you can fix the source.
Why does the hostname show xn-- characters?
Internationalized domain names are converted to Punycode for DNS. A browser shows münchen.de, but the actual host sent over the network is xn--mnchen-3ya.de, which is what the WHATWG URL parser returns.
Does encoding a URL make it safe to use?
Encoding guarantees that the characters are transmitted correctly, not that the destination is trustworthy. Always validate the scheme (for example reject javascript: URLs) and the host before redirecting users to a URL that came from user input.
Are my URLs sent anywhere?
No. Encoding, decoding and parsing all run locally in your browser, so tokens or private links in your URLs never leave your device.