Web Developer Tools · · 4 min read
How to URL Encode Text
Use the URL Encode tool to percent-encode a query value or a full URL, with an optional + for spaces, right in your browser.
To URL encode text, open URL Encode, paste your text into the input, and copy the percent-encoded result — it updates instantly in your browser, with an Encode as choice between a single query value and a full URL, plus an optional toggle to turn spaces into +.
What URL Encode does
Some characters aren't safe to use directly inside a URL — spaces, &, =, ?, #, and others either break the URL's structure or get interpreted as something other than literal text. Percent-encoding replaces each unsafe character with % followed by its hex byte value, so the URL stays valid while still carrying the original data. Toolbench's URL Encode tool gives you two settings for this: Encode as, which decides how aggressive the encoding is, and Spaces as +, which controls whether spaces become + or %20.
How to URL encode text with Toolbench
- Open URL Encode.
- Type or paste your text into the input panel.
- Read the percent-encoded output — it updates as you type.
- Set Encode as to URL component (query value) if you're encoding a single value that's going into a query string, or Full URL (keep :/?#&=) if you're encoding a complete, already-structured URL.
- Turn on Spaces as + if the destination expects spaces as
+rather than%20. - Click Copy to copy the result, or use Send to → to pass it straight into another tool.
Encode as defaults to URL component, and Spaces as + defaults to off.
A real worked example
With the defaults (URL component, Spaces as + off), this input:
https://example.com/search?q=hello world&lang=en
produces:
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den
Notice that the colon, slashes, ?, and & all got encoded too, not just the space — that's the point of URL component mode: it treats the whole input as one opaque value, safe to drop into a single query parameter. It isn't meant for encoding a URL you still want to work as a URL.
Encoding a full URL instead of a single value
If you already have a complete URL and just want to make it safe — escaping a stray space without touching the :, /, ?, &, and = that give it structure — switch Encode as to Full URL (keep :/?#&=). The same input:
https://example.com/search?q=hello world&lang=en
now produces:
https://example.com/search?q=hello%20world&lang=en
Only the space changed. The URL is still a working URL — you'd use this mode when cleaning up a URL that has a raw space or other stray character in it, not when preparing a value to insert into one.
What the Spaces as + toggle changes
Turning on Spaces as + post-processes the result, swapping every %20 for +. Encoding this input with URL component mode and the toggle on:
coffee & cream?
gives:
coffee+%26+cream%3F
compared to coffee%20%26%20cream%3F with the toggle off. Both represent the same value once decoded — + for spaces is just a convention from traditional form encoding (application/x-www-form-urlencoded) that some servers and query strings still expect instead of %20.
Reference: what each setting does
| Setting | Default | Effect |
|---|---|---|
| Encode as: URL component | On | Encodes every character unsafe in a single value, including :/?#&= |
| Encode as: Full URL | Off | Keeps :/?#&= intact; only encodes things like spaces and other unsafe characters |
| Spaces as + | Off | Replaces %20 with + in the output |
Tips and common mistakes
- Use URL component for one value, Full URL for a whole address. Running a complete URL through component encoding mangles its slashes and colons, which breaks it as a usable link.
+for spaces is a form-encoding convention, not a universal rule. If you don't know which the destination expects,%20is the safer, unambiguous default.- Encoding a value twice produces double-encoded output.
%20encoded again becomes%2520— if your output has stray%25sequences, you probably ran it through encoding more than once. - This only encodes — it doesn't validate the URL. If you need to check that a URL's structure (host, path, query) is well-formed, use the URL Parser instead.
- Nothing is sent to a server. Encoding happens in your browser as you type.
Related tools
- URL Decode — reverse the process and turn percent-encoded text back into plain text.
- URL Parser — break a full URL into protocol, host, path, and query parameters.
- Base64 / URL Encode — switch between Base64, URL percent-encoding, and HTML entity encoding in one tool.
- Slug Generator — turn a title into a clean, hyphenated URL path segment instead of percent-encoding it.
Frequently asked questions
What's the difference between the two Encode as modes?
URL component encodes everything unsafe in a standalone value, including :, /, ?, &, and = — use it for a single value headed into a query string. Full URL leaves those structural characters alone and only encodes things like spaces, so a complete URL stays a working URL.
Should spaces become + or %20?
%20 is the standard, unambiguous percent-encoding for a space and works everywhere. + for spaces comes from traditional form encoding and is only expected by destinations that specifically use that convention — turn on Spaces as + only if you know that's what's needed.
Why does encoding a full URL in component mode break it?
URL component mode encodes every character that isn't safe in an isolated value, which includes the :, /, ?, &, and = that structure a URL. Encoding a whole URL that way turns it into one long encoded string rather than a working link — switch to Full URL mode to avoid that.
What happens if I encode something that's already encoded?
You get double-encoded output: a % from the first pass gets encoded again into %25, so %20 becomes %2520. If decoding doesn't give you back the expected text, check whether the input was already percent-encoded before you ran it through this tool.
Is my text sent to a server?
No. Encoding happens in your browser as you type. Signed-out visitors have nothing saved; if you're signed in, your input syncs privately to your account.
More guides
- How to Beautify and Format JavaScriptUse the JavaScript Beautifier to turn minified or messy JS into clean, indented code with 2-space, 4-space, or tab indentation.
- How to Minify CSS to Shrink Stylesheet File SizeUse the CSS Minifier to strip comments and whitespace from CSS instantly in your browser, with a real before-and-after example.
- How to Beautify and Format CSSUse the CSS Beautifier to turn minified or cramped CSS into clean, indented rules with 2-space, 4-space, or tab indentation.