🔧Toolify365

URL Encoder / Decoder (percent-encoding, UTF-8 safe)

Use to embed text safely in URLs, query parameters, or form data. Handles spaces, special characters, and Unicode (including CJK and emoji) correctly.

Encoded result
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Dja

Related tools

How it works

What URL encoding is

URLs are restricted to a small set of ASCII characters. To include anything else — spaces, accents, Chinese characters, emoji, special symbols — you replace each unsafe byte with %XX where XX is its hexadecimal byte value. A space becomes %20, a slash %2F, the kanji 漢 becomes %E6%BC%A2 (its UTF-8 bytes percent-encoded).

This calculator uses the browser's built-in encodeURIComponent and decodeURIComponent. It encodes everything that isn't an unreserved character (letters, digits, -._~), which is the right behavior for query parameters and form data.

encodeURI vs encodeURIComponent

JavaScript has two encoders. encodeURI leaves URL structure characters (/ ? & # = + etc.) alone — use it on a full URL. encodeURIComponent escapes all of those — use it on the value inside a query parameter.

This tool uses encodeURIComponent, the safer choice for embedding arbitrary text into a URL. If you have a full URL with structure you want to preserve, encode only the parts that need it.

Common gotchas

Plus sign in URLs. Some servers treat '+' as a space (a legacy from form encoding). encodeURIComponent leaves '+' alone, but a server might decode it to space. To be safe, replace '+' with %2B if you're sending it as data.

Double encoding. Encoding an already-encoded string adds another layer (% becomes %25, so '%20' becomes '%2520'). Always check whether the input is already encoded before running encode again.

Length increase. UTF-8 multi-byte characters expand to 3-4 percent-codes each. A 100-character Japanese string easily becomes a 900+ character URL.

Frequently asked questions

Why isn't my space '%20' decoding to space?

It should — but if you have '+' in a URL it might also represent space (legacy form encoding). Replace + with space first if needed.

Does this handle emoji?

Yes. Emoji are encoded as their UTF-8 byte sequences (typically 4 bytes / 4 percent-codes per emoji).

What's the difference between URL encoding and HTML encoding?

URL encoding uses % notation for URL contexts. HTML encoding uses < > etc. for HTML. Different contexts, different rules.

When should I encode and when not?

Encode any value going into a URL query parameter, path segment containing user input, or form data. Don't encode an already-built URL — that double-encodes.

Why does '%' in my decoded text cause an error?

A bare '%' followed by something that isn't valid hex is invalid percent-encoding. Encode '%' to '%25' before including it in a URL.

Does the browser do this automatically?

Yes — when building URLs via URL or URLSearchParams APIs. This tool exposes the same logic for ad-hoc use.

What characters are 'safe' and don't need encoding?

Letters (A-Z, a-z), digits (0-9), and these: - . _ ~ . Everything else gets percent-encoded by encodeURIComponent.

Does the data leave my browser?

No. Encoding and decoding both run locally.

Disclosure
  • NordVPN

    Sponsored

    Strict no-logs VPN with 6,400+ servers in 111 countries. Threat Protection blocks ads, trackers, and malware while you work online.

    Get NordVPN
  • Cloudways

    Sponsored

    Managed cloud hosting for WordPress and web apps on DigitalOcean, Vultr, and AWS. Fast setup, no server headaches.

    Try Cloudways
  • Fiverr

    Sponsored

    Hire freelancers for design, writing, dev, and marketing — or sell your own services. Millions of gigs at every budget.

    Browse Fiverr

Comments & questions