URL Encode Online

Turn any text into a URL-safe string, with spaces, accents, ampersands and emoji escaped as percent-encoding. Choose component encoding for a single query value, or full-URL encoding for a whole address, and see the difference explained right under the choice. Switch to Decode to reverse it. The work happens in your browser.

Encoding

0 words0 characters0 lines

Why This Tool Matters

Anything you put into a link that was typed by a person needs encoding sooner or later. A developer builds a search link from a user's query and finds that a stray & splits it into two parameters. An email marketer adds a tracking redirect whose target URL has its own query string, and a QA engineer needs a test case containing a space, an é and an emoji to see whether an API handles them. In each case the characters that have a special meaning inside a URL have to be written as %-escapes so they are treated as data.

The choice that matters is which function you use. Component encoding escapes nearly everything, including / ? & = and #, which is correct for one value dropped into a query string or path segment. Full-URL encoding leaves those structural characters alone and only escapes what cannot appear in an address at all, which suits an address that already has a shape. Run a complete URL through the component option and the slashes and colons are escaped too, which breaks it; run a value that contains & through the full option and the ampersand slips through unescaped.

URL encoding in JavaScript and Python

The two options match the two JavaScript functions exactly: encodeURIComponent() and encodeURI(). Python's equivalent is urllib.parse.quote(), but its defaults differ: it leaves / unescaped unless you pass safe='', and it also escapes ! * ' ( ), which JavaScript's functions leave alone.

JavaScript
// One value inside a URL: escape everything structural
encodeURIComponent('café & cream'); // "caf%C3%A9%20%26%20cream"

// A whole address: keep its / ? & = intact
encodeURI('https://example.com/a b?q=café'); // "https://example.com/a%20b?q=caf%C3%A9"

// Build a query string (spaces become +)
new URLSearchParams({ q: 'café & cream' }).toString(); // "q=caf%C3%A9+%26+cream"
Python
from urllib.parse import quote, urlencode

quote('café & cream', safe='')     # 'caf%C3%A9%20%26%20cream'
quote('/a b/café')                 # '/a%20b/caf%C3%A9'  (safe='/' by default)
urlencode({'q': 'café & cream'})   # 'q=caf%C3%A9+%26+cream'

How to Use

  1. 01

    Pick the encoding type

    Use Component for a single value or segment, or Full URL when you have a whole address.

  2. 02

    Enter your text

    Type or paste, and the encoded version appears as you go.

  3. 03

    Copy or round-trip

    Copy the result, or switch to Decode and the output is carried over so you can check it comes back unchanged.

More Text Tools

Frequently Asked Questions

When should I use encodeURIComponent and when encodeURI?

Use encodeURIComponent for a piece of a URL: a query parameter value, a path segment, or a whole URL that is itself being passed as a value, such as a redirect target. Use encodeURI for a complete address whose structure you want to keep, for instance one that contains spaces or non-ASCII letters in the path. When in doubt, and when a value might contain & or =, choose component encoding.

Why is a space encoded as %20 here but as + elsewhere?

%20 is the general rule and works in any part of a URL. The + form comes from HTML form submission (application/x-www-form-urlencoded) and is only understood in query strings. Python's urlencode and quote_plus and JavaScript's URLSearchParams produce +, while encodeURIComponent and encodeURI always produce %20. Servers decode %20 correctly everywhere, so it is the safer choice.

Which characters are never encoded?

Letters A–Z and a–z, digits 0–9, and the symbols - _ . ~ are always left alone. encodeURIComponent also leaves ! * ' ( ) unescaped, and encodeURI additionally keeps ; , / ? : @ & = + $ #. Everything else, including spaces, quotes, angle brackets, accents and emoji, is escaped as UTF-8 bytes, so 🙂 becomes %F0%9F%99%82.

What is double encoding, and how do I avoid it?

If you encode text that is already encoded, each % becomes %25, so %20 turns into %2520 and the server sees a literal "%20" instead of a space. Encode each value once, at the point where you build the URL. If your input already contains escapes you want to keep, decode it first or leave it as it is.

Does it handle accents, emoji and non-English text?

Yes. Characters outside ASCII are converted to their UTF-8 bytes first, and each byte becomes a %-escape. An é becomes %C3%A9, a Japanese character takes three escapes, and an emoji such as 🙂 takes four (%F0%9F%99%82). That is the form web servers and APIs expect, and the Decode tab turns it straight back, so you can confirm the text survives the round trip.

Is my text sent to a server?

No. The encoding is done by your browser's built-in encodeURIComponent and encodeURI functions. Nothing you enter is uploaded or stored, so it is safe for internal URLs, API keys in a query string and other private values.