URL Encoder/Decoder
Encode special characters to percent-encoded format, or decode them back to readable text.
| Character | Encoded | Character | Encoded |
|---|---|---|---|
| Space | %20 | / | %2F |
| ! | %21 | ? | %3F |
| @ | %40 | & | %26 |
| # | %23 | = | %3D |
| + | %2B | : | %3A |
Percent-encoding (RFC 3986) replaces reserved URI delimiter characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) and non-ASCII UTF-8 bytes with their %XX hexadecimal byte equivalents. In cloud infrastructure, unescaped special characters in URIs are one of the most frequent causes of subtle startup crashes after secret rotation.
Real-World Infrastructure Scenarios
- Database & Broker Connection URIs: Auto-generated secrets containing
@,:,/, or?insideDATABASE_URLorREDIS_URLmust be percent-encoded. - Prometheus & Loki HTTP API Queries: Querying
/api/v1/query?query=...with PromQL or LogQL expressions containing{job="api"}and!=requires URL encoding. - Nginx & Ingress Rewrite Rules: Debugging double-encoded paths (
%2520) or OAuth2redirect_uricallback mismatches.
Terminal CLI Equivalents
# URL-encode a string with jq printf '%s' 'p@ss:w/rd#1' | jq -sRr @uri # Let curl URL-encode query parameters automatically curl -G 'http://prometheus:9090/api/v1/query' \ --data-urlencode 'query=rate(http_requests_total[5m])'
Why did my PostgreSQL or Redis connection URI fail when the password had an @ or # character?
Database connection strings (such as postgresql://user:pass@host:5432/db) are parsed according to RFC 3986 URI rules. Reserved characters like @, :, /, ?, and # inside the password segment break the URI parser unless they are percent-encoded (@ becomes %40, # becomes %23, / becomes %2F).
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes every non-alphanumeric character except - _ . ! ~ * ' ( )—including :, /, ?, &, and =—making it the right choice for encoding individual query parameter values or passwords inside connection strings. encodeURI leaves URI structural delimiters intact.
Why do spaces sometimes appear as + and sometimes as %20?
RFC 3986 URI path and query percent-encoding represents a space as %20. Legacy HTML form encoding (application/x-www-form-urlencoded) represents spaces as + and encodes literal plus signs as %2B.
Are my URLs or connection credentials sent to a server?
No. Encoding and decoding happen 100% locally in your browser tab using JavaScript. No connection strings or query parameters ever leave your device.
Configure reverse proxies, Ingress controllers, and secrets safely: