HTML URL Encoder / Decoder

URL-encode or URL-decode HTML strings for safe use in URLs

Input

Output

Paste your input on the left and the result shows up here.

Or drop a file on this box, , or .

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. ?html=<p>Hello</p>), 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 (data:text/html,...) 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

URL encoding and HTML encoding: how do they differ?

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?

Letters, digits and the nine marks - _ . ! ~ * ' ( ) pass through untouched. Everything an HTML snippet is made of gets a percent code: < turns into %3C, = into %3D, a double quote into %22, and an accented letter such as é into two bytes, %C3%A9.

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. The percent-encoding and decoding are done by JavaScript on this page, so your HTML stays on your machine.

Related HTML & Encoding Tools

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