Skip to main contentSkip to navigationSkip to searchSkip to footer

How to Encode a URL Online Free (URL Encoder & Decoder)

Learn what URL encoding is, which characters need encoding, the difference between encodeURI and encodeURIComponent, and how to encode or decode a URL free online.

NextUtils Team
6 min read
šŸ“šTutorials
urldeveloper-toolsutilitiesencodingweb-development
Web development and utilities tools experts

URLs can only contain a limited set of ASCII characters. When a URL contains spaces, non-ASCII characters, or reserved characters like & and =, those characters must be encoded before the URL is transmitted — otherwise the browser or server will misparse it.

This guide explains what URL encoding is, which characters need to be encoded, the difference between encodeURI and encodeURIComponent, and how to use the free URL Encoder & Decoder tool.

What is URL encoding?

URL encoding (formally called percent-encoding, defined in RFC 3986) converts unsafe characters into a percent sign followed by the character's two-digit hexadecimal ASCII code. For example:

CharacterEncoded asWhy it needs encoding
Space%20Spaces are not valid in URLs
&%26Separates query parameters — must be encoded in values
=%3DSeparates key from value — must be encoded in values
+%2BUsed as space in form encoding; encode to preserve literal +
#%23Fragment identifier — must be encoded in values
?%3FStarts query string — must be encoded in values
/%2FPath separator — must be encoded in values
Ć© (non-ASCII)%C3%A9Non-ASCII characters require UTF-8 percent-encoding

How to encode a URL online

1

Open the URL Encoder

Go to the free URL Encoder & Decoder tool — no sign-up required.

2

Select encode or decode mode

Choose Encode to convert a URL or string to percent-encoded format. Choose Decode to convert percent-encoded text back to readable form.

3

Paste your URL or value

Paste the URL, query string value, or any text you want to encode. For query parameter values, paste just the value — not the full URL — to avoid encoding structural characters like ? and &.

4

Copy the output

Click the copy button to copy the encoded or decoded result to your clipboard.

encodeURI vs encodeURIComponent

If you are encoding URLs in JavaScript, you have two built-in functions. Understanding the difference is important:

encodeURI()

Use for: Encode a complete URL

Preserves: / ? & = # : @ ! $ ' ( ) * + , ;

encodeURI("https://example.com/path?q=hello world")
→ "https://example.com/path?q=hello%20world"

encodeURIComponent()

Use for: Encode a URL component value

Preserves: A-Z a-z 0-9 - _ . ! ~ * ' ( )

encodeURIComponent("hello & goodbye")
→ "hello%20%26%20goodbye"

Plus-encoding vs percent-encoding

HTML forms submitted via GET use application/x-www-form-urlencoded encoding, which encodes spaces as + rather than %20. This is why you often see ?q=hello+world in search URLs.

%20 is safer and more universally compatible. When in doubt, use percent-encoding — most servers accept both, but some do not decode + as a space outside of form contexts.

Frequently asked questions

What is URL encoding?

URL encoding (percent-encoding) converts characters that are not allowed in a URL into a safe format. Each unsafe character is replaced with a percent sign followed by its two-digit hexadecimal ASCII code. For example, a space becomes %20 and & becomes %26.

Which characters need to be URL encoded?

Characters that must be encoded include spaces, <, >, #, %, {, }, |, \, ^, ~, [, ], `, and non-ASCII characters. Reserved characters like &, =, +, ?, and / must also be encoded when they appear inside a query string value rather than as URL structure delimiters.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a complete URL and preserves structural characters like /, ?, &, =, #. encodeURIComponent encodes a URL component value and encodes those structural characters too. Use encodeURIComponent when encoding an individual query parameter value.

What does %20 mean in a URL?

%20 is the percent-encoded representation of a space character. The ASCII code for space is 32, which is 20 in hexadecimal — hence %20. You will also see + used for spaces in form data encoding, but %20 is more universally compatible.

How do I decode a URL?

Use the URL Encoder tool in decode mode — paste your percent-encoded URL or string, and the decoded plain text is shown instantly. In JavaScript, use decodeURIComponent() or decodeURI() to decode programmatically.

Why do spaces become + or %20?

HTML forms use application/x-www-form-urlencoded encoding, which encodes spaces as + signs. Percent-encoding encodes spaces as %20. Both are valid in their respective contexts, but %20 is safer and more universally supported.

Encode or decode a URL now

Free, instant, browser-based. Encode query strings, decode API responses, copy in one click — no sign-up.

Open URL Encoder →

Share this article

Related Articles

Continue exploring with these related posts

Ready to try our tools?

Explore our collection of free online tools for developers, designers, and power users.

Explore All Tools

Explore More Tools

Discover our collection of free online tools for developers, designers, and power users