URL encode, decode and parse
Percent-encode and decode text for URLs, or take a URL apart into scheme, host, path and query and edit the query as a table.
Code examples
Copy and paste these into your own project. Each one uses only the language's standard library, so there is nothing to install.
const text = 'name=Zoë & co'
console.log(encodeURIComponent(text))What it does
Percent-encodes and decodes text for use in URLs, and takes a URL apart into its scheme, host, port, path, query and fragment. The query comes as a table of names and values you can edit, and the URL is rebuilt as you change it.
How to use it
- Type or paste text or a URL, one item per line, or drop a text file.
- Pick a mode: Encode escapes everything that is not safe in a single value, Encode URL keeps the structure of a URL and escapes only what cannot be in one, Decode reads percent-encoding and Parse splits a URL into parts.
- In Parse mode, change a parameter in the query table, add or remove one, and copy the rebuilt URL from the input.
Examples
Encoding a value:
name=Zoë & co becomes name%3DZo%C3%AB%20%26%20co. The URL https://example.com/zoek?q=kaas en brood becomes https://example.com/zoek?q=kaas%20en%20brood with Encode URL.
Good to know
- A space is written as
%20. In the query of a URL a+also means a space; the query table reads it that way. - Characters outside ASCII are encoded as UTF-8 bytes:
ébecomes%C3%A9. - Parse never fails: a relative reference such as
/a/b?x=1just has no scheme or host. - Decoding fails on a
%that is not followed by two hex digits, and on escapes that are not valid UTF-8; that line is skipped.
What is percent-encoding?
URLs can only hold a small set of safe characters. Anything else, such as a space, an accent or an ampersand in a value, is written as a % and the two hex digits of each byte: a space becomes %20 and é becomes %C3%A9. Decoding reverses it.
Frequently asked questions
What is the difference between Encode and Encode URL?
Encode escapes everything that is not a letter, digit or one of - . _ ~, which is right for a single value such as a query parameter. Encode URL leaves the characters that give a URL its structure, such as : / ? # & and =, and only escapes what cannot appear in one at all, like spaces and accents.
Why does a plus sign turn into a space in the query table?
In the query part of a URL a + stands for a space, a habit from HTML forms. The table reads it that way, and writes a space back as %20, which every parser accepts.
Does this tool send my URLs anywhere?
No. Everything happens in your browser. What you type is never sent to our servers.