URL Encoder / Decoder

Encode and decode URLs online. Convert special characters to URL-safe format for use in web addresses and API calls.

Input

Plain Text

Output

Encoded Text

Common Use Cases

Email Address

user@example.com

Query with Spaces

hello world test

Special Characters

!@#$%^&*()+=[]{}|;:'",.<>?

URL with Parameters

https://example.com?name=John Doe&age=30

International Text

Hello 世界 مرحبا мир

File Path

/path/to/file name.txt

JSON String

{"name": "John", "age": 30}

HTML Content

<div class="test">Hello & Goodbye</div>

Web Safe

Convert special characters to URL-safe format for use in web addresses

Multiple Methods

Choose between standard, full URI, or custom encoding methods

Character Analysis

See exactly which characters need encoding and their encoded values

Query Builder

Parse and build query strings with automatic parameter encoding

When to Use URL Encoding

Query Parameters

Encode values passed in URL query strings to handle spaces and special characters

Form Data

When submitting forms with application/x-www-form-urlencoded content type

API Calls

Encode parameters in REST API URLs to ensure proper transmission

File Paths

Handle spaces and special characters in file paths within URLs

Code Examples

JavaScript

// Encode
encodeURIComponent('hello world') // "hello%20world"

// Decode
decodeURIComponent('hello%20world') // "hello world"

Python

import urllib.parse

# Encode
urllib.parse.quote('hello world') # "hello%20world"

# Decode
urllib.parse.unquote('hello%20world') # "hello world"

PHP

// Encode
urlencode('hello world'); // "hello+world"
rawurlencode('hello world'); // "hello%20world"

// Decode
urldecode('hello%20world'); // "hello world"

Frequently Asked Questions

What's the difference between encodeURI and encodeURIComponent?
encodeURI() is used to encode complete URIs and preserves characters that are valid in URIs (like :, /, ?, #).encodeURIComponent() encodes all special characters and is used for encoding individual URI components like query parameter values. Use encodeURIComponent for query string values and encodeURI for complete URLs.
Why do spaces become %20 or +?
Spaces can be encoded as either %20 or + depending on the context. In URLs, %20 is the percent-encoded representation of a space. However, in application/x-www-form-urlencoded data (like form submissions), spaces are encoded as +. Both are valid, but %20 is more universally compatible.
Which characters need to be encoded?
Reserved characters that have special meaning in URLs must be encoded: ! * ' ( ) ; : @ & = + $ , / ? # [ ]. Additionally, any character outside the unreserved set (A-Z, a-z, 0-9, -, _, ., ~) should be encoded. This includes spaces, quotes, angle brackets, and non-ASCII characters.
How do I handle Unicode/international characters?
Unicode characters are first converted to UTF-8 bytes, then each byte is percent-encoded. For example, the character "世" (U+4E16) becomes %E4%B8%96 in UTF-8 encoding. Modern browsers and servers handle this automatically when you use standard encoding functions.