AlfennAI

URL Encoder

Percent-encode text and URLs for safe use in query strings and links.

Loading tool...

How it works

URLs can only safely contain a limited set of characters -- spaces, ampersands, question marks and many others have special meaning or aren't allowed raw, which is why they need percent-encoding (e.g. a space becomes %20) before being placed in a query string or link. Get this wrong and a URL parameter can silently truncate, merge with another parameter, or break entirely.

This tool encodes using encodeURIComponent, the correct choice for encoding individual values that will be placed inside a URL -- as opposed to encoding an entire URL at once, which needs different handling since it must preserve characters like : and / that are structurally meaningful.

Works with full Unicode text too, so non-English characters, emoji, and special symbols all encode correctly for safe transmission in any URL.

Frequently asked questions

What's the difference from encodeURI?

This uses encodeURIComponent, which also escapes characters like &, = and ? -- correct for encoding individual query parameter values rather than a full URL, where those characters are structurally meaningful.

Why do spaces become %20?

Spaces aren't valid in URLs, so they're percent-encoded as their ASCII hex value (20 in hex = 32 decimal, the space character's code point).

Do I need to encode an entire URL, or just parts of it?

Usually just the values going into query parameters, not the whole URL -- encoding the full URL would also escape the protocol separators and slashes that need to stay intact.

Does this work for non-English text?

Yes -- any Unicode character gets correctly percent-encoded as its UTF-8 byte sequence.

Related tools