Skip to content
Toolora

URL Encoder

Convert text to percent-encoded form for use in query strings and paths, with a separate mode for encoding a complete URL.

Developer Runs in your browser Works offline
Loading tool…

How it works

Percent-encoding replaces every character that has a special meaning in a URL — or that cannot appear in one at all — with a % followed by its hexadecimal byte value. A space becomes %20, an ampersand %26.

The two modes matter. Encoding a single value escapes everything, including / ? & and =, because inside a parameter those are data. Encoding a whole URL leaves that structure alone and escapes only the rest.

The formula

Value encoding

encodeURIComponent — escapes : / ? # [ ] @ & = + $ , and space

Whole-URL encoding

encodeURI — preserves reserved characters that define URL structure

Worked examples

ScenarioWorkingResult
“a & b”Value modea%20%26%20b
“café”UTF-8 bytes escapedcaf%C3%A9
https://x.com/a bWhole-URL modehttps://x.com/a%20b

When you'd use it

  • Putting a search term into a query string safely
  • Building a redirect URL that carries another URL
  • Fixing a link that breaks when it contains an ampersand
  • Encoding a filename with spaces for a download link

Common questions

Which mode should I use?

Value mode for anything going into a single parameter — that is the common case. Whole-URL mode only when you are cleaning up a complete address and want :// and ? to keep working.

Why does a space sometimes become + instead of %20?

In the older form-encoding scheme a space is +. In modern percent-encoding it is %20, which this tool produces. Both are widely accepted in query strings, but %20 is correct in a path.

Is my text uploaded?

No. Encoding happens in your browser using the standard JavaScript functions.