URL Encoder & Decoder for Form Data
Encode or decode text, build the application/x-www-form-urlencoded body a form sends, or paste a body or URL to see every field decoded. Nothing you type is sent to a server.
Form style matches what a browser sends for application/x-www-form-urlencoded. Without it, Encode uses encodeURIComponent, which writes a space as %20.
How form data is encoded
When a form posts with the default enctype, the browser joins each field as name=value and separates fields with &. To keep that structure safe, it encodes every name and value:
encodeURI is a different tool: it encodes a whole URL and leaves &, =, ? and / alone, so it can't make a value safe. Use encodeURIComponent for one value, or URLSearchParams to build a full form body with spaces as +.
URL encoding FAQ
Why does a form turn spaces into + instead of %20?
The application/x-www-form-urlencoded format comes from early HTML forms, which wrote a space as +. Browsers still do this when a form posts with the default enctype, and URLSearchParams does the same. Servers that read form bodies turn + back into a space. In other parts of a URL, a space is written %20.
What is the difference between encodeURI and encodeURIComponent?
encodeURI is for a whole URL, so it leaves characters like : / ? & = and # alone. encodeURIComponent is for one value, so it escapes those too. Use encodeURIComponent (or URLSearchParams) for form field names and values, or an & inside a value will split it into two fields.
How are non-English characters encoded?
The text is first turned into UTF-8 bytes, then each byte is written as % and two hex digits. For example, é is two bytes and becomes %C3%A9, and an emoji is four bytes.
Why do I get an 'Invalid percent-encoding' error when decoding?
Every % must be followed by two hex digits, and the bytes must form valid UTF-8. A stray % (as in 100%) or a cut-off sequence like %E2%82 can't be decoded. Encode a literal percent sign as %25.
Is anything I paste sent to a server?
No. Encoding, decoding, building and parsing all run in your browser with the built-in encodeURIComponent, decodeURIComponent and URLSearchParams. Nothing is sent or stored.
Related
Free form tools
Related tools.
Browse all 40 free tools
Form builders & HTML
Regex testers
- Alphanumeric regex tester
- Email regex tester
- Phone number regex tester
- ZIP code regex tester
- Number regex tester
- Date regex tester
- Name regex tester
- Username regex tester
- IP address regex tester
- URL regex tester
- Password regex generator
- Time regex tester
- Credit card regex tester
- Hex color regex tester
- UUID regex tester
Email & DNS
Converters & encoders
Calculators & marketing