URL Encoder
—
Formula: encodeURIComponent(text)
URL Encoder
URL encoding ensures special characters are safely transmitted in URLs.
Conversion Formula
encodeURIComponent(text)
Characters are converted to their UTF-8 byte values, then each byte is represented as %XX in hexadecimal.
Step-by-Step Examples
hello world = hello%20world
Space is encoded as %20
price=10&tax=5 = price%3D10%26tax%3D5
= and & are encoded
Frequently Asked Questions
What is URL encoding?
URL encoding replaces unsafe characters with a % followed by two hex digits. Spaces become %20, & becomes %26, etc.
When do I need to URL encode?
When passing special characters in query parameters, form data, or any part of a URL that might contain reserved characters.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URI preserving :, /, ?, #, etc. encodeURIComponent encodes everything except letters, digits, and - _ . ~ !