URL
URL Encode
Encode text for URLs using either full-URI mode or component mode, depending on whether reserved URL separators should remain readable.
Runs locally in your browser. Your input is not uploaded.
How this tool works
URL encoding converts characters into percent-encoded sequences when they are unsafe or ambiguous in URLs.
The two modes behave differently for reserved characters, so the tool keeps the mode visible.
Examples
- Encode a query parameter value that contains spaces and ampersands.
- Encode a full URL while preserving its separators.
- Encode a Unicode query value separately before inserting it into a full URL.
Common use cases
Choosing the right encoding mode
Use encodeURIComponent mode for query parameter values, path segments, or nested redirect values. Use encodeURI mode for a complete URL when separators such as : / ? & should remain URL syntax.
Encoding the wrong unit is a common source of broken redirects, missing query values, and double-encoded strings.
Practical examples
- Encode a search query that contains spaces and ampersands before putting it in a URL.
- Encode a nested redirect URL as a query parameter value.
- Keep a full URL readable by using full-URI mode only when the URL structure is already correct.
Invalid or unsafe assumption
Invalid/failure example
Encoding an entire URL with component mode also encodes separators such as colon and slash.
Mistakes to avoid
- Using component encoding on a complete URL.
- Building a query before encoding each name and value.
- Encoding already percent-encoded text a second time.
Limits of this workflow
Percent encoding does not validate that a URL is safe or reachable.
Form encoding has additional plus-for-space rules not applied by encodeURIComponent.
Local-processing and privacy boundary
URL text remains in browser memory only; never place secrets in URLs because downstream histories and logs may record them.
Practical workflow
- Decide whether input is a component or a complete URL.
- Encode once with the matching mode.
- Inspect reserved separators.
- Test the final URL in its actual consumer.
Related guides
Official references
FAQ
When should I use encodeURIComponent?
Use it for query parameter values or path segments where separators should be escaped.
When should I use encodeURI?
Use it for a complete URL when characters like : / ? & should remain part of the URL syntax.
Should query values be encoded individually?
Yes. Encode each name and value before joining them with query separators.