How Do You URL Encode a Question Mark (?)?

The url encoding of "?" is %3F. The question mark (?) is URL encoded as %3F. In URLs, the question mark has a special meaning -- it separates the path from the query string. When you need a literal question mark inside a query parameter value, you must encode it as %3F to prevent the URL parser from treating it as a query separator.

Why Encode "?"?

The ? character delimits the query string in a URL (e.g., /search?q=hello). If your data contains a literal question mark (e.g., a quiz question "What is 2+2?"), encoding it prevents the URL parser from misinterpreting it as a second query separator.

Encoding Details

Character?
Encoded form%3F
Encoding typeURL encoding
Unicode code pointU+003F

Code Examples

JavaScript

encodeURIComponent('What is 2+2?');
// "What%20is%202%2B2%3F"

Python

from urllib.parse import quote
quote('What is 2+2?')
# 'What%20is%202%2B2%3F'

Try It Yourself

Use our URL Encoder to encode any character instantly.

Frequently Asked Questions

When should I NOT encode a question mark in a URL?

Do not encode the question mark that separates the URL path from the query string. Only encode question marks that appear inside parameter values. For example, in /search?q=What%3F, the first ? is structural and the second is encoded data.

What is the difference between encodeURI and encodeURIComponent?

encodeURI preserves URL structure characters (?, &, =, /, #) while encodeURIComponent encodes everything except unreserved characters. Use encodeURIComponent for parameter values and encodeURI for complete URLs.

Is %3F case-sensitive?

No. Both %3F and %3f are valid. However, RFC 3986 recommends uppercase hex digits for consistency.

Built by Michael Lip. 100% client-side — no data leaves your browser.