URL Encoder / Decoder

Encode special characters in URLs or decode encoded URL strings.

About URL Encoder / Decoder

URL encoding (also called percent-encoding) replaces characters that are not allowed in a URL with a %XX sequence, where XX is the two-digit hexadecimal value of the character. This ensures that special characters like spaces, ampersands, and slashes are transmitted safely in a URL without changing its meaning.

Encoding modes

Query String mode uses encodeURIComponent, which encodes everything including / : ? = & #. Use this when encoding the value of a single query parameter (e.g. a search term or redirect URL).

Full URL mode uses encodeURI, which preserves structural URL characters like : / ? & =. Use this when encoding an entire URL that must remain navigable.

When to URL-encode

  • Redirect parameters — encode a return URL in a ?redirect= parameter so it is not parsed as part of the outer URL.
  • Search queries — spaces and special characters in a search term must be encoded before appending to a URL.
  • Form submissions — browsers encode form data automatically, but manual encoding is needed in scripts and API calls.
  • Webhook URLs — encode callback URLs passed as parameters to external services.

About the URL Encoder

URL encoding (also called percent-encoding) replaces characters that have reserved meaning in URLs with a percent sign followed by two hexadecimal digits. The reserved set includes characters like the space (which becomes %20), ?, &, #, =, /, and all non-ASCII characters. Encoding is required when building query strings, redirect URLs, or any other context where a value must travel inside a URL without being misinterpreted.

This tool encodes plain text into a URL-safe form and decodes percent-encoded URLs back to readable text. It supports both encodeURIComponent semantics (encodes everything except a small set of unreserved characters, suitable for individual query values) and decodeURIComponent for the reverse.

Why URL encoding exists

A URL has a strict grammar: the ? separates path from query, the & separates query parameters, the # marks the fragment, and so on. If your value contains those characters literally, it breaks parsing. Percent-encoding lets any byte appear safely inside any component of a URL. Modern browsers automatically encode characters as you type into the address bar — but when you build URLs programmatically (or by hand for an API call), you need to encode yourself.

encodeURI versus encodeURIComponent

JavaScript exposes two related functions. encodeURI is intended for whole URLs; it leaves the structural characters (/?#&=) alone. encodeURIComponent is intended for individual values to be inserted into a URL; it encodes everything that is not unreserved. Almost always, when you build a URL from parts, you want encodeURIComponent on the values. Using encodeURI for a query value is a frequent source of subtle bugs.

How to use the URL Encoder

  1. Paste plain text to encode

    Drop the value you want to put into a URL. Anything counts: emojis, accents, spaces, ampersands, equals signs.

  2. Or paste an encoded URL to decode

    Switch to decode mode to recover the human-readable form from a percent-encoded string.

  3. Copy the result

    Use the result directly in your application code, fetch call, or anchor tag.

Worked examples

Example 1

Input: hello world

Result: hello%20world

The space, the most common character to encode, becomes %20.

Example 2

Input: a&b=c

Result: a%26b%3Dc

Both & and = must be encoded inside a query value, or the URL parser splits at them.

Example 3

Input: 日本語

Result: %E6%97%A5%E6%9C%AC%E8%AA%9E

Non-ASCII characters are first UTF-8 encoded, then each byte is percent-encoded.

Real-world use cases

  • Building query strings for REST API calls by hand.
  • Constructing redirect URLs that contain user-supplied values.
  • Encoding search terms before inserting them into a URL fragment.
  • Decoding a URL captured from a browser address bar back into readable text.
  • Debugging "why does my API call return 400?" — often the answer is unencoded special characters.

Tips & common mistakes

  • When in doubt, use encodeURIComponent. encodeURI is rarely what you want unless you are encoding an entire URL string at once.
  • A "+" in a query string usually means a space in form-encoded data, but a literal + in path-encoded URLs. The two contexts treat the same character differently.
  • Most HTTP client libraries (fetch, axios, requests) URL-encode query parameters automatically when you pass them as an object. You only need this tool when you are building the URL by hand.

Frequently asked questions

What is the difference between URL encoding and HTML encoding?

URL encoding (percent-encoding) makes text safe inside a URL. HTML encoding (entities) makes text safe inside HTML. They use different escape syntaxes and apply in different contexts — using one where the other is needed will fail.

Will this tool encode the / and : characters?

With encodeURIComponent semantics, yes. With encodeURI semantics, no. Choose based on whether you are encoding a value or a whole URL.

How are non-ASCII characters handled?

They are first encoded as UTF-8 bytes, then each byte is percent-encoded. Modern web infrastructure assumes UTF-8 for non-ASCII characters in URLs.

Is the input sent to a server?

No. Encoding and decoding both happen entirely in your browser.

Related tools

Last updated: June 2026 · All processing happens locally in your browser.