URL encoder, decoder and inspector
Percent-encode or decode text and see exactly which characters changed. Three encodings are explained in plain words, a broken % code is pointed out instead of just failing, and a URL pasted into the inspector is split into host, path, parameters and fragment. Nothing is uploaded: it all runs in this page.
Encode or decode text
Type or paste text, pick what you are encoding, and the result updates as you type. Chinese, emoji and other characters are turned into UTF-8 percent codes (%E4%BD%A0).
14 of 25 characters were changed (highlighted).
Result
name%3DZo%C3%AB%20%26%20%E4%BD%A0%E5%A5%BD%20%F0%9F%98%80%20%2F%2050%25%20off
abc = changed
Take a URL apart
Paste a URL to see its scheme, user, host, port, path, query parameters and fragment. Edit the parameters below and the URL is rebuilt for you.
Only needed when the URL above is relative, like /path?x=1 or ../page. Leave empty for a full URL.
Parts
- Scheme
- https
- User
- user
- Password
- p%40ss
- Host
- xn--mnchen-3ya.de
- Host (Unicode)
- münchen.de
- Port
- 8443
- Origin
- https://xn--mnchen-3ya.de:8443
- Path
- /a%20b/%E6%96%87%E6%A1%A3
- Fragment
- top
International names are stored in an ASCII form (punycode, starting with xn--). Both forms are shown.
Path segments
| # | As written | Decoded |
|---|---|---|
| 1 | a%20b | a b |
| 2 | %E6%96%87%E6%A1%A3 | 文档 |
Query parameters
Shown decoded, in the order they appear. Repeated names are kept. A name without = is shown with an empty value.
On: a space becomes +. Off: a space becomes %20. Both are read as a space in query strings, but + is not a space in a path.
URL
No changes yet. Edit a parameter to rebuild the URL.
How it works
- •Percent-encoding writes a character as its UTF-8 bytes, each as % and two hex digits. The Chinese character 你 becomes %E4%BD%A0 and an emoji becomes four codes. Pick "one value" for a query value or path segment, "a whole URL" for an address that must keep working, or "form data" for what a web form sends.
- •The three modes match what JavaScript and browsers do: one value is encodeURIComponent, a whole URL is encodeURI, and form data is the URLSearchParams format. The differences are small but real. Form data writes a space as + and also encodes ~ ! ' ( ). Python's quote_plus keeps ~ and encodes *, the opposite of the web standard.
- •Decoding is strict by default. If a % is not followed by two hex digits, or the bytes are not valid UTF-8 (a cut-off %E4%BD, or text that was encoded as GBK), the page marks the exact spot instead of showing garbage. Tick "Decode what can be decoded" to get Python-style output with replacement characters.
- •A + is a space only in form data and query strings, never in a path, so decoding has a separate form mode. Text such as %2520 is flagged as probably encoded twice, because %25 is the code for % itself; decode once more to get the real text.
- •The inspector uses the same URL parser as your browser (the WHATWG URL standard), which is not the same as Python's urlsplit. It drops default ports (:443), resolves /a/../b, writes spaces and non-English letters in the path as %20 codes, turns backslashes into slashes, rewrites numeric hosts such as 0x7f.1 to 127.0.0.1, and converts international domain names to punycode. Both the xn-- form and the readable form are shown. Query parameters split on & only, not on ;.
- •Limits: 200,000 characters of text and 20,000 for a URL. A URL needs a scheme such as https:// to be read on its own; for a relative URL, enter a base URL. Edited parameters are re-encoded in form style, so a %20 in the original may become +, which servers read the same way in a query string.
Questions
- Is my text uploaded?
- No. Encoding, decoding and the URL parser all run in this page and nothing is sent anywhere. Copy happens on your device.
- Should I use %20 or + for a space?
- In a path, always %20. In a query string both mean a space to almost every server, but %20 is the safer choice because + is only a space in form-style data. To be sure what a given server expects, check its documentation.
- Why does my text show %2520?
- Something encoded an already encoded string: the % of %20 became %25. Decode once to get %20 and once more to get the space, or use the Decode once more button. Fix the code that encodes twice, since decoding twice on the other side can break text that really contains a percent sign.
- Which mode should I choose for a link with Chinese characters in it?
- Use the whole URL mode on the full address, which keeps :, /, ? and & intact. If you are inserting a value into a link, such as a search term, encode just that value in the one-value mode, because a value containing & or # would otherwise break the link.