URL Encoder

URL Encoder

Encode any URL or text to percent-encoding instantly in your browser. Follows RFC 3986. Free, no sign-up required.

Updated May 2026

Shift + Enter to Copy · Shift + for tabs
Input URL
0 characters
Encoding Options
Technical Insight

URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. This is crucial for passing data in the query string.

Encoded Result
Speed
Instant
Privacy
Local Only

Free URL Encoder Online — Percent-Encode Any String Instantly

Stop losing hours debugging malformed URLs in API requests. This free URL encoder converts your text or URL to safe percent-encoding in milliseconds — directly in your browser, with zero data sent to any server.

Paste anything — a full URL, a query parameter value, a path segment, or a raw string — and the encoded output appears instantly. Choose whether to preserve reserved characters like /, ?, and &, or encode everything with encodeURIComponent semantics for strict query parameter safety.

How to Use the URL Encoder

Three steps, done in seconds:

  1. Paste your URL or text into the input field — the tool accepts any Unicode text, including accented characters, CJK ideographs, and emoji. The character count updates in real time so you can track the input size.
  2. Select your encoding options — enable "Encode reserved characters" to use strict encodeURIComponent mode (recommended for query parameter values), or disable it to preserve URL structure characters like /, ?, #, and &. Toggle "Space as +" for application/x-www-form-urlencoded compatibility with HTML form submissions.
  3. Copy the result — the percent-encoded output appears immediately below. Click Copy or press Shift + Enter to send the encoded string to your clipboard.

Need to reverse the process? Click Swap & Decode to send the encoded output directly to the URL Decoder.

What Is URL Encoding and Why Does It Matter

URL encoding — formally called percent-encoding — is the mechanism defined in RFC 3986 for representing characters that are either unsafe or have reserved meaning inside a URL. Every unsafe character is replaced with a percent sign (%) followed by its two-digit hexadecimal UTF-8 code. A space becomes %20, an ampersand becomes %26, and a hash becomes %23.

The reason this matters: URLs can only be transmitted reliably over the internet using a limited set of ASCII characters. Characters outside that safe set — including Unicode letters, punctuation, and control characters — must be encoded before they become part of a URL. Skipping this step causes servers to misparse query strings, routing to break, and API calls to fail silently.

URL Encoding Examples

Real input/output pairs to reference when building or debugging URLs:

Input Encoded Output
hello world hello%20world
user@example.com user%40example.com
price: €100 price%3A%20%E2%82%AC100
name=João&city=São Paulo name%3DJo%C3%A3o%26city%3DS%C3%A3o%20Paulo
https://example.com/path?q=test https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dtest
café caf%C3%A9
🚀 %F0%9F%9A%80
`` (empty string) `` (empty output)

All examples above use encodeURIComponent mode (reserved characters encoded). If you switch to "Preserve reserved characters" mode, the last example in that table — the full URL — would keep its /, ?, and = intact.

Encoding Options Explained

Encode reserved characters (recommended for query parameters): Uses JavaScript's encodeURIComponent, which encodes everything except A–Z a–z 0–9 - _ . ~. This is the correct mode when encoding a single value that will appear inside a query string. Characters like /, ?, #, &, and = are encoded.

Preserve reserved characters (for full URLs): Skips encoding on characters that have structural meaning in a URL (/ ? # [ ] @ ! $ & ' ( ) * + , ; =). Use this when encoding an entire URL where you want the structure to remain intact.

Space as + (plus): Replaces %20 with +. Required when submitting HTML form data with Content-Type: application/x-www-form-urlencoded. Not appropriate for URL path segments.

Common Mistakes with URL Encoding

Knowing what to avoid saves you hours of debugging:

  • Encoding the entire URL instead of parameter values only. If you percent-encode https://api.example.com/search?q=hello as a whole URL with encodeURIComponent, every /, ?, and = gets encoded — the result is not a valid URL, it is a string. Encode only the dynamic values that go inside the query string.
  • Confusing encodeURI() and encodeURIComponent(). encodeURI is safe for a full URL and preserves structural characters like / and ?. encodeURIComponent is safe for a single component value and encodes those structural characters. Using encodeURI on a parameter value will silently leave &, =, and + un-encoded, causing the server to misparse the query string.
  • Double-encoding an already-encoded string. If you encode a string that already contains %20, the % itself gets encoded to %25, turning %20 into %2520. Always start from the raw, decoded string. If the source is already encoded, decode it first with the URL Decoder, then re-encode.
  • Using + for spaces in path segments. The +-for-space convention comes from application/x-www-form-urlencoded and is only valid inside query strings. A + in a path segment is treated as a literal plus sign, not a space. Always use %20 for spaces outside query strings.
  • Not encoding non-ASCII characters. Accented letters, CJK characters, and emoji must be UTF-8-encoded before percent-encoding. A server that receives a raw é in a query string may handle it inconsistently across browsers. This tool always applies UTF-8 encoding, so é correctly becomes %C3%A9.

Common Use Cases

  • Query string parameters: When building a URL like https://api.example.com/search?q=hello world&lang=pt, the value hello world must be encoded to hello%20world. Missing this step breaks the request on most servers.
  • Passing URLs as parameter values: If a redirect URL appears inside another URL — e.g., ?redirect=https://example.com/page?foo=bar — the inner URL must be fully encoded, otherwise the outer URL parser splits on the unencoded ? and =.
  • Encoding form data: Applications that POST data as application/x-www-form-urlencoded (the default for HTML forms) require spaces as + and special characters percent-encoded.
  • Generating safe href attributes: Percent-encoding ensures that link href values containing characters like <, >, ", or spaces don't break HTML parsing or cause XSS vectors.
  • API authentication signatures: Many API signing algorithms (AWS Signature V4, OAuth 1.0a) require specific percent-encoding of query parameters before computing the HMAC. Getting the encoding wrong produces invalid signatures that reject every request.

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI is designed for full URLs — it preserves all characters that have structural meaning in a URL, including /, ?, #, &, and =. Use it when you want the URL structure to remain intact. encodeURIComponent is designed for a single component value (like a query parameter) and encodes those structural characters too, making it stricter. If you are encoding a parameter value that will appear inside a query string, always use encodeURIComponent — or the "Encode reserved characters" option in this tool.

Why does a space become %20 in some contexts and + in others?

Both represent a space, but in different specifications. %20 is the percent-encoding defined in RFC 3986 and is valid anywhere in a URL. The + sign for spaces comes from the older application/x-www-form-urlencoded format used by HTML forms. Most modern web frameworks accept both in query strings, but if you're encoding a path segment, always use %20. Enable "Space as +" in this tool when working with form submissions.

Should I encode the entire URL or just the query parameters?

Encode only the parameter values, not the full URL structure. Encoding the entire URL — including the scheme (https://), domain, and path — will break it by turning / into %2F and : into %3A. The correct approach is to build the base URL first (https://api.example.com/search?q=), then append encodeURIComponent(value) for each dynamic parameter value. This tool's "Preserve reserved characters" mode is designed for encoding a full URL while keeping its structure intact.

What is the difference between %20 and + for spaces in URLs?

%20 is the RFC 3986 standard percent-encoding for a space and is valid in any part of a URL — path segments, query strings, fragment identifiers. The + sign for spaces is part of the application/x-www-form-urlencoded media type used by HTML form submissions and is only valid inside query strings. Some servers and frameworks treat + as a space in query strings but not in path segments. When in doubt, use %20 — it works everywhere.

How do I encode a URL that already contains percent signs?

If your input already has % characters that are part of real percent-encoded sequences, encoding it again will double-encode them — %20 becomes %2520. To avoid this, decode the URL first using the URL Decoder, then re-encode it cleanly. This ensures a single consistent encoding layer.

Is this tool safe to use with sensitive data like passwords or API keys?

Yes. This tool processes everything locally in your browser using JavaScript. No text is transmitted to any server, and nothing is stored. You can verify this by opening your browser's network inspector while using the tool — you'll see zero outbound requests.

Does URL encoding work for non-Latin characters like Arabic, Chinese, or emoji?

Fully supported. This tool uses UTF-8 encoding for all non-ASCII characters, which is the standard required by RFC 3986. A Chinese character like becomes %E4%B8%AD — three percent-encoded bytes representing its UTF-8 sequence. Emoji work the same way: 🚀 encodes to %F0%9F%9A%80.

Resources

Related Tools