URL encoder/decoder · Guide

URL Encode Colon: Handling : , and - in URLs

Three characters that look similar in a URL behave very differently. One is reserved and sometimes needs encoding, one is reserved and usually ignored, and one never needs encoding at all.

Colon — reserved, context dependent

: separates the scheme from the rest of the URL and the host from the port. Inside a value it must be %3A, or a strict parser may misread the URL.

In practice, a colon inside a query value is widely accepted — ?filter=status:active works nearly everywhere. Inside a path segment it is riskier, and in the first segment of a relative URL it is genuinely dangerous: foo:bar can be parsed as a scheme. Encode it there.

Timestamps are the everyday case: 2026-08-29T14:30:00Z in a query string becomes 2026-08-29T14%3A30%3A00Z when encoded properly.

Comma — reserved, rarely enforced

, is in the reserved set as a sub-delimiter, so %2C is the correct escape. Most frameworks accept a literal comma in query values without complaint.

The catch is that some APIs treat a comma as a list separator: ?ids=1,2,3 means three values. If a comma inside your data would be read that way, encoding it as %2C is what distinguishes one value containing a comma from several values.

Hyphen — never encode it

- is unreserved, alongside _, . and ~. It is safe everywhere in a URL and should be left as-is.

Encoding it as %2D is technically legal but produces a non-canonical URL, which can break cache keys, signature checks and analytics grouping. Some encoders do it anyway — if yours does, that is a reason to switch functions.

Frequently asked questions

Does a colon in a query string need encoding?

Usually it works unencoded, but %3A is correct and safe. Encode it in path segments, where a colon can be misread as a scheme.

Do I need to encode a hyphen?

No. It is unreserved and safe everywhere.

When must I encode a comma?

When the receiver treats commas as list separators and your value legitimately contains one.

Ready to try it?

Open the free browser-based URL encoder/decoder and apply what you just read — no sign-up, runs locally.

Open the URL encoder/decoder tool