Input

Output

What Is HTML URL Encoding?

URL encoding (also called percent encoding) converts characters that are not allowed in a URL into a %XX form where XX is the character's hexadecimal UTF-8 code. For example, a space becomes %20, < becomes %3C, and > becomes %3E. This is defined in RFC 3986.

When you need to include HTML markup in a URL parameter — for example, passing HTML content to a server endpoint or embedding it in a query string — the HTML must be URL-encoded so that angle brackets, quotes, and ampersands don't break the URL structure. This tool uses the JavaScript encodeURIComponent() function for encoding.

How to URL-Encode or Decode HTML

Follow these steps to encode or decode HTML strings.

1

Paste Your HTML or Encoded String

Paste the HTML you want to encode, or an already encoded string you want to decode, into the Input panel.

2

Choose Encode or Decode

Click Encode to convert HTML into URL-safe percent-encoded form. Click Decode to convert a percent-encoded string back to readable HTML.

3

Copy the Result

Click Copy to copy the encoded or decoded output to your clipboard.

When to URL-Encode HTML

Query String Parameters

When passing HTML content as a URL query parameter (e.g. <code>?html=&lt;p&gt;Hello&lt;/p&gt;</code>), the HTML must be encoded to prevent it from breaking the URL parser.

API Requests with HTML Payloads

Some REST APIs accept HTML content in GET request parameters. URL-encode the HTML before appending it to the endpoint URL.

Embedding in Data URIs

Data URIs (<code>data:text/html,...</code>) require the HTML content to be URL-encoded for correct parsing by browsers.

Decoding Scraped URLs

When analyzing URLs from scraped data or logs, decode percent-encoded HTML to read its original form.

Common Questions

What is the difference between URL encoding and HTML encoding?

HTML encoding replaces characters like < with HTML entities like &lt;. URL encoding replaces characters with %XX percent codes for safe use inside URLs. They serve different purposes and should not be confused.

Which characters are encoded?

encodeURIComponent encodes everything except: A-Z a-z 0-9 - _ . ! ~ * ' ( ). All other characters including spaces, < > & " # % { } | \ ^ [ ] ` are encoded.

Is this the same as Base64?

No. URL encoding replaces individual characters with percent codes. Base64 encodes binary data into a text representation using 64 printable ASCII characters. They are completely different encoding schemes.

Can I encode a full HTML page?

Yes. Paste the entire HTML document and it will be encoded. Be aware that very long strings may hit URL length limits in browsers (typically 2000-8000 characters depending on browser and server).

Is my data stored?

No. Encoding and decoding happen entirely in your browser. Nothing is sent to a server.

Related HTML & Encoding Tools

More tools for encoding, escaping, and working with HTML: