Skip to main content

URL Encoder & Decoder - Encode URLs Online Free

Free URL encoder and decoder tool encodes URLs, query parameters, and special characters instantly. Support for URL encoding, Base64, HTML entities. Perfect for web developers and API testing. Copy & paste results - no signup required!

0 characters

Output will appear here...

0 characters (0%)

Common Examples

About URL Encode

Encodes special characters except :/?#[]@!$&'()*+,;=

Best for:
Full URLs with query parameters

Encoding Reference

Space%20
&%26
?%3F
=%3D
#%23

Common Use Cases

  • API parameter encoding
  • Form data submission
  • Email link generation
  • JavaScript URL handling with our case converter
  • SEO-friendly URLs (kebab-case)

Understanding URL Encoding and Why It Matters

What is URL Encoding?

URL encoding (also called percent encoding) converts special characters into a format that can safely transmit over the internet. URLs can only contain certain characters from the standard ASCII character set - letters, numbers, and a few symbols. Everything else must be encoded.

When you encode a URL, special characters get replaced with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20, an ampersand becomes %26.

Why URLs Need Encoding

Without encoding, URLs break. Try sending https://example.com/search?q=hello world - that space confuses browsers and servers about where the URL ends. After encoding it becomes https://example.com/search?q=hello%20world, making it unambiguous and safe to transmit.

Common Characters That Need Encoding

Spaces → %20

Most common encoding need. Spaces break URLs immediately without encoding.

Special Characters → % codes

Characters like & ? # = / have special meaning in URLs and must be encoded when used as data.

Non-ASCII Text → UTF-8 encoding

Languages like Chinese, Arabic, Thai must be encoded because URLs only support ASCII characters.

Reserved Characters

! * ' ( ) ; : @ & = + $ , / ? % # [ ] have special URL meanings and need encoding when used as literal text.

Different Types of Encoding

URL Encode vs URL Component

URL Encode (encodeURI) is gentler - it preserves characters that are part of valid URL structure like ://, ?, &. Use this when encoding a complete URL.

URL Component (encodeURIComponent) is more aggressive - it encodes everything including /, ?, &. Use this for individual query parameter values to prevent them from being interpreted as URL structure.

Base64 URL-Safe Encoding

Standard Base64 uses +, /, and = which have special meaning in URLs. URL-safe Base64 replaces these: + becomes -, / becomes _, padding removed.

Common in JWT tokens, OAuth state parameters, and when you need to embed binary data or large text blocks in URLs. Our Base64 encoder handles standard Base64 encoding.

HTML Entity Encoding

Different from URL encoding - this converts characters to HTML entities to display them safely in web pages. < becomes &lt;, preventing browser from interpreting it as an HTML tag.

Critical for security - prevents XSS (cross-site scripting) attacks when displaying user-generated content. Always encode HTML special characters before showing them on web pages.

When to Use Each Type

  • URL Encode: Complete URLs with multiple parts
  • Component: Query parameters, form data, search terms
  • Base64: Binary data, tokens, file contents in URLs
  • HTML: Displaying code snippets, user comments, any untrusted HTML

Frequently Asked Questions

What's the difference between URL encoding and Base64?

URL encoding converts special characters to %XX format (percent encoding) and only affects characters that aren't URL-safe. Base64 converts all data into a completely different character set using A-Z, a-z, 0-9, and + / characters. Base64 makes data larger (~33% increase) but URL encoding only changes special characters.

Why does my URL have %20 instead of spaces?

Spaces aren't allowed in URLs according to internet standards (RFC 3986). When you see %20, that's the encoded version of a space character. Some systems use + instead of %20 for spaces in query strings (like form data), but %20 is the standard URL encoding that works everywhere.

Can URL encoding protect against hacking?

URL encoding alone doesn't provide security - it's just a format transformation. However, proper encoding prevents some injection attacks by ensuring special characters don't get misinterpreted. For security, you need HTML entity encoding (prevents XSS), input validation, and parameterized queries. Our tool helps with proper formatting, but always validate input on the server side.

Do I need to encode URLs for APIs?

Yes, especially query parameters. If you're sending search=hello world, it must be search=hello%20world. Most modern HTTP libraries (fetch, axios, requests) handle this automatically, but if you're manually constructing URLs or testing in tools like curl, you need to encode parameters yourself.

Why does decoding sometimes fail?

Decoding fails when the input isn't properly encoded or is corrupted. Common issues: incomplete percent sequences (just % without two digits), mixing different encoding types, or trying to decode already-decoded text. If decoding fails, verify the text was actually encoded and isn't corrupted. Sometimes double-encoding happens - encoding already-encoded text - which requires decoding twice.

Should I encode the entire URL or just parameters?

Encode individual components, not the complete URL. Use URL Component encoding for query parameter values: ?name=John%20Doe&email=john%40example.com. Don't encode the structure (?, &, =) or protocol (https://). If you need to encode a complete URL as data (like a redirect parameter), then encode the whole thing.

What characters don't need URL encoding?

Unreserved characters never need encoding: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). Everything else should be encoded to be safe, though some reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) might be okay depending on context. When in doubt, encode it - extra encoding is better than broken URLs.

Can I use URL encoding for email addresses?

Yes! Email addresses in URLs (like mailto: links or as query parameters) need encoding. The @ symbol becomes %40, + becomes %2B. For example: mailto:john%2Btest%40example.com. This ensures email addresses work correctly even when they contain special characters.