URL Encoder / Decoder
Percent-encode and decode URLs and query strings, and break any URL into protocol, host, path and editable query parameters.
encodeURIComponent: escapes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use it for a single query value or path segment.
URL parser & query editor
Paste a URL to see how browsers split it (WHATWG URL standard) and edit its query parameters.
| Protocol | https: | |
|---|---|---|
| Username | user | |
| Password | secret | |
| Host | example.com:8080 | |
| Hostname | example.com | |
| Port | 8080 | |
| 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 | |
| Origin | https://example.com:8080 |
Query parameters (4)
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.
Related tools
- JSON FormatterFormat, validate, minify and explore JSON with precise error locations. Your data never leaves the browser.
- JSON to TypeScriptPaste JSON and instantly generate TypeScript interfaces or type aliases with nested types, optional fields and arrays. Free and offline.
- Regex TesterTest and debug JavaScript regular expressions with live match highlighting, capture groups, flags and replace preview.
- UUID / ULID GeneratorGenerate cryptographically random UUID v4, time-ordered UUID v7, ULID and Nano ID identifiers in bulk, and inspect or convert existing IDs — locally in your browser.
- Hash GeneratorGenerate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes or HMACs from text and files and verify checksums — computed locally with Web Crypto.
- JWT DecoderDecode JWT header and payload, check expiry, and verify HS, RS, PS, ES and EdDSA signatures locally with Web Crypto — your token never leaves the browser.