← All Free Tools
Free Online Utility

URL Encoder & Decoder

Percent-encode text for safe use in URLs and query strings, or decode it back.

About the URL Encoder & Decoder

This free tool percent-encodes text using JavaScript's encodeURIComponent (and decodes with decodeURIComponent) entirely in your browser — the correct choice for safely embedding a value inside a URL query string or path segment.

What gets encoded

Characters outside the small set considered "safe" in a URL — letters, digits, and a handful of punctuation marks (- _ . ! ~ * ' ( )) — are converted to a % followed by two hex digits representing the character's UTF-8 byte value. A space becomes %20, & becomes %26, and so on.

encodeURIComponent vs. encodeURI

encodeURIComponent (used by this tool) escapes every reserved character, including &, =, ?, and /, which makes it correct for encoding a single value that will be inserted into a query string or path segment. encodeURI leaves those structural characters alone because it's meant to encode an entire, already-structured URL rather than one piece of it — using it on a query value would leave & and = unescaped and break the URL's structure.

When you need this

Any time you're building a URL programmatically and inserting user input, search terms, or data containing spaces, punctuation, or non-ASCII characters into a query string (?q=...) or path — encoding prevents the URL from breaking or being misparsed by the browser or server.

Frequently asked questions

What is URL encoding?

Percent-encoding converts unsafe characters (spaces, &, ?, #, non-ASCII) into a % followed by two hex digits, so they can be safely included in a URL.

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent escapes all reserved characters (&, =, ?, /) for encoding one value in a query string. encodeURI leaves those alone since it encodes a whole, already-structured URL.

Why do spaces sometimes become + instead of %20?

Inside an application/x-www-form-urlencoded query string, + conventionally means space. Outside that context, %20 is correct — this tool uses the standard %20 form.

Why do I need to URL-encode text before putting it in a link?

URLs only support a limited character set directly. Anything else must be percent-encoded or the URL may break or be misinterpreted.

Related tools & guides

Base64 Encoder / DecoderJSON Formatter & ValidatorAll Free Tools