URL encoder / decoder
- Runs on your device
- Nothing uploaded
- Free, no sign-up
Client-side only. Uses the browser encodeURI / encodeURIComponent APIs. Nothing is uploaded.
A query string that breaks without encoding
Say you want q=nails & tips as a search value. If you paste that raw into a URL, the & starts a new parameter and the space splits the request. Component mode turns the value into something a parser can treat as one field:
| Piece | Raw | Component-encoded |
|---|---|---|
| Space | (U+0020) | %20 |
| Ampersand | & | %26 |
| Equals | = | %3D |
| Accented e | é | %C3%A9 (UTF-8) |
| Flower emoji | 🌸 | %F0%9F%8C%B8 |
Build the URL as ?q= plus the encoded value, not by encoding the whole ?q=... string in component mode (that would encode the ? and = too).
Component vs full URL
Component matches encodeURIComponent / decodeURIComponent. Use it for one value you will drop into a query string, path segment, or header that expects a single token.
Full URL matches encodeURI / decodeURI. It escapes spaces and non-ASCII characters but leaves structural characters alone: :/?#[]@!$&'()*+,;=. Reach for it when the input is already shaped like https://example.com/path?x=1 and you only need the unsafe bits percent-encoded.
Wrong scope is a common bug: full-URL encode on a lonely a&b leaves the & untouched, which is usually not what you wanted for a query value.
Spaces, plus signs, and form bodies
This tool follows the JavaScript URL APIs: spaces become %20, and + stays +. HTML form encoding (application/x-www-form-urlencoded) historically used + for spaces. If you are talking to an API that still expects that dialect, encode with component mode, then replace %20 with + for that hop only. Decode the other way: turn + into a space before decodeURIComponent when the peer used form encoding.
What this page will not do
- Upload or log your string (no server round-trip).
- Parse or rebuild a full URL object graph. For query editing beyond encode/decode, use a dedicated URL builder.
- Base64 or JWT work. For payloads in Base64 see the Base64 encoder; for HS256 tokens see the JWT encoder.
- Guess which dialect a remote API wants. Check the docs for
%20vs+and for whether reserved characters should stay literal.
Percent-encode URLs in code
Encode one value, build a whole query string, and decode. Watch the space: path-style encoding gives %20, form encoding gives +.
JavaScript: encodeURIComponent and URLSearchParams
// One query value or path segment: encodeURIComponent
console.log(encodeURIComponent("a&b=c d/é")); // a%26b%3Dc%20d%2F%C3%A9
// Whole query strings: URLSearchParams (form encoding, space becomes +)
const qs = new URLSearchParams({ q: "rock & roll", page: "2" });
console.log(`https://example.com/search?${qs}`); // q=rock+%26+roll&page=2
console.log(decodeURIComponent("caf%C3%A9")); // café
Python: urllib.parse
from urllib.parse import quote, unquote, urlencode
print(quote("a&b=c d/é", safe="")) # a%26b%3Dc%20d%2F%C3%A9
print(quote("/docs/my file.pdf")) # keeps "/" by default: /docs/my%20file.pdf
print(urlencode({"q": "rock & roll", "page": 2})) # q=rock+%26+roll&page=2
print(unquote("caf%C3%A9")) # café
Go: net/url
package main
import (
"fmt"
"net/url"
)
func main() {
fmt.Println(url.QueryEscape("a&b=c d/é")) // a%26b%3Dc+d%2F%C3%A9 (space as +)
fmt.Println(url.PathEscape("my file.pdf")) // my%20file.pdf
v := url.Values{}
v.Set("q", "rock & roll")
v.Set("page", "2")
fmt.Println(v.Encode()) // page=2&q=rock+%26+roll (keys sorted)
s, _ := url.QueryUnescape("caf%C3%A9")
fmt.Println(s)
}
Each snippet was run on October 14, 2026 with Node.js 20, Python 3.14 and Go 1.24.
URL encoding specs: RFC 3986 and WHATWG
- RFC 3986: URI Generic Syntax
- RFC 3986, section 2.1: percent-encoding
- RFC 3986, section 2.3: unreserved characters: A-Z a-z 0-9 - . _ ~ never need encoding
- WHATWG URL Standard: application/x-www-form-urlencoded: the form rules where a space becomes +
- MDN: encodeURIComponent()
- Python docs: urllib.parse
- Go docs: net/url
FAQ
Does this URL encoder upload my text?
No. Encoding and decoding run in JavaScript on this page. ToolPetal has no backend for URL conversion.
When should I use component mode vs full URL mode?
Use component mode (encodeURIComponent) for a single query value, path segment, or form field so characters like &, =, ?, and / become percent-encoded. Use full URL mode (encodeURI) when you already have a complete URL and only need spaces and non-ASCII characters escaped while leaving :/?&=# intact.
Why does a plus sign stay as + after encode?
JavaScript encodeURIComponent leaves + alone and turns spaces into %20. Older application/x-www-form-urlencoded forms often used + for spaces. If a server expects +, replace %20 with + after encoding, or encode a space as + yourself for that API.
What happens on invalid percent sequences?
Decode throws when a % is not followed by two hex digits, or when the bytes are not valid UTF-8. This page shows the error instead of inventing a string.