Something wrong with this tool?

About Url Encode Online

This tool percent-encodes a string for safe use in URLs. Special characters like spaces, &, =, ?, /, and non-ASCII characters are converted to their %XX hexadecimal form (e.g., space becomes %20, & becomes %26).

URL encoding is required whenever you embed user data in a query string, a path segment, or any other URL component. Without it, browsers and servers misinterpret special characters as syntax separators — turning a search query like "cats & dogs" into broken parameters.

The tool encodes either an entire URL or just a single component, depending on which mode you select. Component mode aggressively encodes everything that could be misinterpreted; full-URL mode leaves protocol scheme and structure intact.

How to use this tool

How to percent-encode text for safe use in URLs

  1. Paste the text

    Drop the raw string into the "Text" field. The tool encodes any character outside the URL-safe set (`A-Z a-z 0-9 - _ . ~`) as `%XX` bytes using UTF-8.

  2. Press Run

    Result returns a single `encoded` field. Examples: `hello world` → `hello%20world`; `café` → `caf%C3%A9`; `a+b` → `a%2Bb` (since `+` means space in query strings).

  3. When to use it

    Wrapping a value before putting it in a URL path or query: `?q=` + encode(userInput). Don't encode the whole URL — only individual components (path segments, query values), or you'll mangle the `://` and `?`.

  4. Component vs full URL

    This is `encodeURIComponent` semantics — strict. `encodeURI` would leave `?` and `:` alone for use in a whole URL. If you accidentally double-encode, `%20` becomes `%2520`; symptom: literal `%20` showing in the rendered page.