urlencode Online — PHP-style URL Encoding in Your Browser
encodeURIComponent · encodeURI · RFC 3986 — Query Params Table · URL Builder · Batch Mode — 100% browser-side
Paste text → get encoded URL
Real-time · 200ms debounce · No button click needed
urlencode is the PHP function that encodes strings for safe URL transmission — spaces become +, special characters become %XX. This tool replicates PHP's urlencode and rawurlencode behavior in your browser. Use it to encode form data, query strings, and API parameters without running a PHP server.
What is URL Encoding?
URL encoding (percent encoding) converts special characters into a % followed by two hex digits. For example, a space becomes %20, & becomes %26, and / becomes %2F. This ensures URLs remain valid across all browsers, servers, and APIs regardless of the special characters they contain.
encodeURIComponent vs encodeURI vs RFC 3986
encodeURIComponent is the safest choice for encoding individual query parameter values — it encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ). encodeURI is designed for full URLs and preserves characters like : / ? # [ ] . RFC 3986 is the strictest standard — also encoding ! ' ( ) * — recommended for OAuth signatures and API authentication headers.
Frequently Asked Questions
What does PHP urlencode do?
PHP urlencode() converts spaces to + and encodes special characters as %XX. The JavaScript equivalent is encodeURIComponent() but uses %20 for spaces instead of +. This tool uses %20 (the modern standard).
What is the difference between urlencode and rawurlencode in PHP?
PHP rawurlencode() follows RFC 3986 — it uses %20 for spaces and encodes more characters. urlencode() uses + for spaces and is designed for HTML form data. Use rawurlencode (RFC 3986 mode in this tool) for modern APIs.
How do I urlencode in JavaScript?
Use encodeURIComponent() — it is equivalent to PHP rawurlencode(). Example: encodeURIComponent("hello world") returns "hello%20world". See the JS snippet in the Code Snippets panel.
How do I urlencode in Python?
Use urllib.parse.quote(text, safe="") for rawurlencode equivalent. Use urllib.parse.quote_plus(text) for urlencode (+ for spaces). See the Python snippet in this tool.
Is urlencode the same as percent encoding?
Essentially yes. urlencode is the PHP function name for percent encoding. The underlying mechanism is the same — unsafe characters are replaced with %XX sequences.