Input

Output encodeURIComponent

URL Encoding Examples

Spaces become %20, & becomes %26, = becomes %3D, and so on. The two modes differ in which characters they preserve:

encodeURIComponent (Component mode)

Input:

Input

Output (Component mode — encodes : / ? & =):

Output

Output (Full URL mode — preserves URL structure):

Output

What Is URL Encoding?

If you have ever tried to put a search query with spaces or special characters into a URL, you know the pain: the browser needs those characters encoded so the URL doesn't break. URL encoding (or percent encoding) converts reserved and unsafe characters into a % followed by two hex digits. It is defined in RFC 3986 and is fundamental to how the web works. A space becomes %20, & becomes %26, and so on. This tool provides both encodeURIComponent() and encodeURI() modes, runs entirely in your browser, and never sends your data to a server.

There are two modes, and each one is simply a JavaScript built-in doing the work. Component mode uses encodeURIComponent(), which leaves only A–Z a–z 0–9 - _ . ! ~ * ' ( ) alone and escapes every other character. Reach for it when you are encoding one query parameter value. Full URL mode uses encodeURI(), which keeps the characters that give a URL its shape (: / ? & #) as they are. That is the one for a whole address. To decode, use the URL Decoder.

How to Use This Tool

1

Choose Encoding Mode

Select Component to encode a query parameter value (e.g., a search term). Select Full URL to encode a complete URL while keeping its structure intact. Not sure what to type? Sample loads a search URL with a space and a plus sign in its query string.

2

Paste Your Input

Put the value or address in the left editor and the percent-encoded version shows up on the right while you type. The escaping is done by your browser's own JavaScript, so a URL with a session token or an API key in its query string is not sent off anywhere.

3

Copy or Download

Hit Copy to paste the escaped string into your code or a curl command, or Download to keep it in a .txt file. To turn %XX sequences back into readable text, open the URL Decoder.

Component vs Full URL Mode

Mode comparison

For query string values always use Component mode. For example, if the search term is rock & roll, the correct query parameter is q=rock%20%26%20roll—not q=rock & roll which breaks the query string structure.

Frequently Asked Questions

Is my data private?

Yes. Percent-encoding is done by your own browser, and the text you enter is not transmitted anywhere.

What is the difference between %20 and + for spaces?

In the application/x-www-form-urlencoded format (HTML form submissions), spaces are encoded as +. In standard percent encoding (RFC 3986), spaces are encoded as %20. This tool uses %20. If you need + for form data, replace %20 with + after encoding.

Which mode should I use for a full URL?

Use Full URL mode (encodeURI) when encoding a complete URL you want to keep navigable. Use Component mode (encodeURIComponent) when encoding a value that will be placed inside a query parameter, path segment, or fragment. The WHATWG URL Living Standard is the definitive reference for how modern browsers parse and encode URLs.

Does it support Unicode characters?

Yes. Non-ASCII characters like é, 中, or emoji are first encoded to UTF-8 bytes and then percent-encoded. For example, é becomes %C3%A9.

Related Tools

For the specification, see RFC 3986. MDN covers encodeURIComponent and encodeURI in detail.