URL encoder and decoder — percent-encoding for APIs, links, and forms

Use this free URL encoder online to percent-encode query parameters, path segments, and arbitrary Unicode text with the same encodeURIComponent rules your frontend and Node stacks rely on—or switch to encodeURI when you are normalizing a mostly complete URI. The URL decoder reverses %XX sequences with decodeURIComponent, optional plus-as-space handling for application/x-www-form-urlencoded data, and copy-friendly output. Everything runs client-side—ideal for OAuth redirect URIs, analytics pixels, email templates, and log lines you cannot ship to a third party. Pair it with the Base64 encoder for binary-safe payloads and the JWT decoder when tokens travel in fragments or query strings.

Mode

Encode (query & segments) uses encodeURIComponent. Encode (full URI) uses encodeURI. Decode uses decodeURIComponent.

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)

  1. Choose Encode (query & segments) for API parameters, slugs, and arbitrary strings; choose Encode (full URI) for mostly formed URLs; choose Decode to expand %XX sequences back to Unicode.
  2. Paste your text into Input or click Load sample to experiment. For decoding HTML form data, enable Treat + as space.
  3. Press Encode or Decode to populate Output. Use Copy output for curl, Postman, or CMS fields.
  4. 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 & ValidatorFormat, validate, minify, and explore JSON in a collapsible tree—fix payloads before they hit production.
  • JSON to CSV ConverterTurn JSON arrays into downloadable CSV with automatic column detection for spreadsheets and BI tools.
  • JSON to YAML ConverterConvert JSON to readable YAML for configs and Kubernetes—copy or download the result.
  • CSV to JSON ConverterPaste or upload CSV and get structured JSON with header-aware typing for APIs and apps.
  • YAML to JSON ConverterParse YAML to valid JSON with clear errors—ideal for CI configs and cloud templates.
  • XML Formatter & ValidatorBeautify and validate XML with structure insight and actionable parse errors.
  • Regex Tester & DebuggerTest patterns live with highlights, capture groups, and flags—debug regex without leaving the browser.
  • SQL FormatterPretty-print SQL with indentation and keyword casing for readable queries and code review.
  • HTML Formatter & MinifierBeautify or minify HTML and compare raw markup with a quick rendered preview.
  • CSS Formatter & MinifierFormat messy stylesheets or minify CSS for faster loads—keep design tokens consistent.
  • JavaScript Formatter & MinifierPretty-print or minify JavaScript for debugging locally and shipping smaller bundles.
  • HTML to Markdown ConverterConvert HTML snippets to Markdown for docs, CMS migrations, and README cleanup.
  • Markdown to HTML ConverterTurn Markdown into HTML with a live preview—handy for emails, blogs, and static pages.
  • Code Diff CheckerCompare two code blocks side by side with clear add/remove highlighting for reviews.

Frequently asked questions

What is the difference between URL encoding and Base64?
URL encoding (percent-encoding) replaces unsafe or reserved characters with a % followed by two hex digits so text fits in query strings, paths, and fragments per RFC 3986. Base64 represents binary as ASCII letters, digits, and symbols—common for attachments and data URIs, not for general URL text. Use this page for percent-encoding; use the site’s Base64 tool when you need binary-safe transport in text protocols.
When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent for a single query parameter value, form field, or path segment where nearly every reserved character must be escaped. Use encodeURI when you have an almost-complete URL and only need to escape characters that are illegal in URIs while keeping structure characters like slashes, question marks, and colons where appropriate. Misusing encodeURI on a lone parameter value often leaves & and = unescaped and breaks parsers.
Is my text sent to your servers?
No. Encoding and decoding run entirely in your browser with the same APIs your app would use (encodeURIComponent, decodeURIComponent, encodeURI, decodeURI). Nothing is uploaded unless you copy or share the result yourself.
Why does decode fail with URI malformed?
decodeURIComponent throws when it sees an incomplete percent sequence (a lone %), invalid hex digits after %, or UTF-8 sequences that do not decode cleanly. Fix stray % characters, ensure pairs like %20 are complete, and try treating + as a space if the string came from application/x-www-form-urlencoded data.
How do I handle plus signs (+) in query strings?
In HTML form submissions, spaces are often encoded as + and decodeURIComponent does not convert + to a space. Enable the “Treat + as space” option before decoding, or replace + with space manually, then decode. When building new query strings, prefer %20 for spaces inside encodeURIComponent output for consistency.
Does URL encoding encrypt or hide secrets?
No. Percent-encoding is reversible and not confidentiality. Anyone can decode the string. For secrets use proper encryption, TLS in transit, and server-side storage—never rely on encoding alone.
Can I encode non-ASCII characters like emojis or accented letters?
Yes. JavaScript encodes Unicode using UTF-8 bytes in percent form (for example café becomes sequences starting with %C3). The decoder reconstructs the original Unicode string. Very long strings may slow the tab slightly, but typical snippets and URLs work fine.
Which related tools pair well with URL encoding?
Inspect live URLs and redirects with the redirect chain checker and HTTP header checker; validate SSL and DNS when debugging broken links; use the Base64 encoder for binary payloads; decode JWT segments separately with the JWT decoder when tokens appear in query strings—all available in this project’s Website and Code tool sections.