Why URL encoding matters for developers and SEO
Percent-encoding is how HTTP, HTML forms, and JavaScript keep reserved characters from colliding with URL syntax. Spaces, ampersands, hashes, and non-ASCII letters must become %-prefixed byte sequences so servers, CDNs, and crawlers parse query strings predictably. Getting encoding wrong produces double-encoded links, broken UTM tags, and 400 responses from strict APIs. For live pages, validate outbound URLs with our redirect chain checker and broken link checker; for headers and caches, follow with the HTTP header checker.
This page focuses on RFC 3986-style encoding as implemented in browsers—parallel to what you get from URLSearchParams for individual values. It does not replace TLS or certificate hygiene; when URLs point at production hosts, confirm certificates with the SSL certificate checker.
encodeURIComponent vs encodeURI (quick reference)
encodeURIComponent escapes almost every reserved character, which is what you want for a single name=value pair’s value, a slug with slashes you must hide, or arbitrary text embedded in a path segment. encodeURI leaves delimiters such as /, ?, and # unescaped so the skeleton of a URL stays readable—useful when you paste a nearly valid URL that only needs a few illegal characters fixed. When unsure, default to encodeURIComponent for each dynamic segment, then assemble the final string in code.
How to use this URL encoder and decoder (step by step)
- Choose Encode (query & segments) for API parameters, slugs, and arbitrary strings; choose Encode (full URI) for mostly formed URLs; choose Decode to expand
%XXsequences back to Unicode. - Paste your text into Input or click Load sample to experiment. For decoding HTML form data, enable Treat + as space.
- Press Encode or Decode to populate Output. Use Copy output for curl, Postman, or CMS fields.
- Click Swap to input when you need a second pass—for example decode, edit, then re-encode with a different mode.
Common pitfalls: double encoding, raw ampersands, and UTF-8
Double encoding happens when a framework already encodes a value and you encode again before concatenating—servers see %2520 instead of %20. Decode once with this tool to confirm the intermediate shape, then encode exactly once at the boundary you control. Raw & inside a value breaks query parsing unless encoded as %26. Unicode characters become multi-byte UTF-8 percent sequences; that is normal and preferred over legacy non-UTF-8 encodings in modern APIs.
JSON, APIs, and structured data workflows
REST and GraphQL gateways often log percent-encoded URLs inside JSON. When you need to inspect payloads before encoding URL fields, run them through the JSON formatter first, copy the string value, then encode or decode here. For marketing URLs embedded in JSON-LD, keep characters consistent with the visible href users click so crawlers and humans see the same destination.
Related developer tools
Browse the full code and developer tools catalog. Highlights:
- JSON Formatter & Validator — Format, validate, minify, and explore JSON in a collapsible tree—fix payloads before they hit production.
- JSON to CSV Converter — Turn JSON arrays into downloadable CSV with automatic column detection for spreadsheets and BI tools.
- JSON to YAML Converter — Convert JSON to readable YAML for configs and Kubernetes—copy or download the result.
- CSV to JSON Converter — Paste or upload CSV and get structured JSON with header-aware typing for APIs and apps.
- YAML to JSON Converter — Parse YAML to valid JSON with clear errors—ideal for CI configs and cloud templates.
- XML Formatter & Validator — Beautify and validate XML with structure insight and actionable parse errors.
- Regex Tester & Debugger — Test patterns live with highlights, capture groups, and flags—debug regex without leaving the browser.
- SQL Formatter — Pretty-print SQL with indentation and keyword casing for readable queries and code review.
- HTML Formatter & Minifier — Beautify or minify HTML and compare raw markup with a quick rendered preview.
- CSS Formatter & Minifier — Format messy stylesheets or minify CSS for faster loads—keep design tokens consistent.
- JavaScript Formatter & Minifier — Pretty-print or minify JavaScript for debugging locally and shipping smaller bundles.
- HTML to Markdown Converter — Convert HTML snippets to Markdown for docs, CMS migrations, and README cleanup.
- Markdown to HTML Converter — Turn Markdown into HTML with a live preview—handy for emails, blogs, and static pages.
- Code Diff Checker — Compare two code blocks side by side with clear add/remove highlighting for reviews.