Skip to main content
ByteKiwi
Home URL Encoder

URL Encoder

Online URL encoder and decoder. Percent-encode special characters in URLs and query strings with real-time output and one-click copy.

Input
URL-encoded

Features

Everything you need, nothing you don’t.

  • Percent-encodes special characters in real time as you type
  • Uses encodeURIComponent for safe query parameter and form data encoding
  • Handles Unicode characters, spaces, and all reserved URL characters
  • One-click copy encoded output to clipboard
  • Expand either pane to fullscreen for working with long URLs
  • No data leaves your browser - everything runs client-side

Frequently asked questions

What is URL encoding?

URL encoding (also called percent-encoding) replaces characters that are not allowed or have special meaning in URLs with a % followed by their two-digit hexadecimal ASCII code. For example, a space becomes %20 and & becomes %26. This ensures the URL is safely transmitted over the internet.

When do I need to URL-encode a string?

Encode a string when passing it as a query parameter value, form field value, or path segment that may contain spaces, special characters, or non-ASCII characters. For example, a search query hello world should be encoded to hello%20world before appending it to a URL.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a complete URL but leaves URL-structural characters like /, ?, #, and = intact. encodeURIComponent encodes everything except letters, digits, and -_.!~*'() - making it safe for encoding individual query parameter values. This tool uses encodeURIComponent.

Why does a space become %20 and not "+"?

In standard percent-encoding (RFC 3986), spaces are encoded as %20. The + notation for spaces is specific to the application/x-www-form-urlencoded format used in HTML forms. For URLs and API query parameters, %20 is the correct and widely compatible encoding.

What characters are NOT encoded?

encodeURIComponent does not encode unreserved characters: letters (A-Z, a-z), digits (0-9), hyphen (-), underscore (_), period (.), exclamation mark (!), tilde (~), asterisk (*), single quote ('), and parentheses. All other characters, including /, ?, =, &, #, and spaces, are percent-encoded.

Can I use this to encode a full URL?

This tool uses encodeURIComponent, which also encodes / and ?, so it is designed for encoding values within a URL, not full URLs. If you paste a complete URL, the slashes and query string structure will be encoded. Use this for individual query parameter values, then assemble the full URL separately.

How do I URL-encode a string in Python?

Use urllib.parse.quote() from the standard library:

from urllib.parse import quote, urlencode

# Encode a single value (equivalent to encodeURIComponent)
quote('hello world!', safe='')  # 'hello%20world%21'

# Encode a dict of query parameters
urlencode({'q': 'hello world', 'lang': 'en'})
# 'q=hello+world&lang=en'
Can I use this to URL-encode an SVG for CSS?

Yes. Inlining an SVG in a CSS url() requires percent-encoding certain characters. Paste your SVG markup and the encoder will handle spaces, angle brackets, quotes, and other characters that break CSS parsing. The resulting encoded string can be used directly as a background-image: url('data:image/svg+xml,...') value.

URL Encoding in Other Languages

Code snippets for URL-encoding in common programming languages.

URL Encoding in Java

Use java.net.URLEncoder from the standard library. Note that Java's URLEncoder uses + for spaces (HTML form encoding) rather than %20 - replace if needed:

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

String value = "hello world!";

// Encodes spaces as + (HTML form style)
String encoded = URLEncoder.encode(value, StandardCharsets.UTF_8);
// Result: hello+world%21

// Encode spaces as %20 (URL-style)
String urlEncoded = URLEncoder.encode(value, StandardCharsets.UTF_8)
    .replace("+", "%20");
// Result: hello%20world%21