URL Encoder/Decoder + HTML Entities

Encode URLs, decode percent escapes, and escape HTML entities.

Tool
Action
URL scope
Input
Output
Ready. Paste text and choose an action.

Your URL and HTML text is converted in your browser. Nothing is uploaded to BroBroGo.

FAQ

Should I choose URL component or full URL?

Use component for query values, path pieces, or form values. Use full URL when you want to keep characters such as : / ? & = readable.

What does HTML entity escaping change?

It turns characters such as <, >, &, quotes and non-ASCII text into entities that can be pasted safely into HTML text or attributes.

Why does URL decoding sometimes fail?

Percent escapes must be complete UTF-8 sequences. A broken sequence such as %E0%A4%A cannot be decoded without guessing.

The Purpose and Function of URL Encoding and Decoding

URL encoding, also known as percent-encoding, is a mechanism used to convert arbitrary text into a format that can be safely transmitted over the Internet within a Uniform Resource Identifier (URI). The internet standard for URLs restricts the allowed character set to a small group of unreserved characters, which includes alphanumeric characters and a few symbols. Any character outside this allowed set must be converted.

The encoding process replaces non-allowed characters with a percent sign (%) followed by a two-digit hexadecimal representation of the character's byte value in UTF-8. For example, a space character becomes %20, and the ampersand symbol & becomes %26.

URL decoding reverses this process. It scans the encoded string for percent-encoded sequences, interprets the hexadecimal values as bytes, and reconstructs the original UTF-8 characters. This ensures that special characters, non-ASCII characters, and spaces are preserved accurately when transmitted across different web systems.

Encoding a URL Component vs. a Full URL

When working with web addresses, you must distinguish between processing an entire URL and processing a single query parameter or path segment.

Component Encoding

URL component encoding is designed for individual values that sit inside a URL, such as query values, path pieces, or form values. This mode uses the JavaScript function encodeURIComponent for encoding and decodeURIComponent for decoding. It aggressively encodes almost all non-alphanumeric characters, including :, /, ?, &, and =. For example, if you need to pass a full URL as a query parameter inside another URL, you must use component encoding so that the query delimiters of the nested URL do not break the structure of the main URL.

Full URL Encoding

Full URL encoding is used when you have a complete web address and want to encode only the characters that are genuinely illegal in a URL, while leaving the functional address delimiters intact. This mode uses the JavaScript functions encodeURI and decodeURI. It keeps characters such as :, /, ?, &, and = readable so that the browser can still parse the string as a valid, navigable address.

Character Component Mode (encodeURIComponent) Full URL Mode (encodeURI)
: %3A :
/ %2F /
? %3F ?
& %26 &
= %3D =

HTML Entity Escaping and Unescaping

HTML entity escaping is the process of converting specific characters into safe, predefined representations called HTML entities. This is a fundamental practice when preparing text to be displayed inside an HTML document.

Escaping targets characters that have structural meaning in HTML, such as the less-than sign (<), greater-than sign (>), ampersand (&), and quotation marks (" and '). If you paste raw text containing these characters directly into an HTML document, the browser may misinterpret them as HTML tags or attribute delimiters, which disrupts the page layout or prevents the text from rendering correctly. Escaping converts these characters into safe sequences like &lt;, &gt;, and &amp;. It also converts non-ASCII characters into entities to ensure they render correctly regardless of the character encoding settings of the hosting web page.

HTML entity unescaping performs the opposite action. It takes text containing entities and converts them back into their literal character representations, making the text readable for standard editing or processing.

Percent Escapes and UTF-8 Sequence Requirements

When decoding URLs, the percent-encoded sequences must represent complete, valid UTF-8 byte sequences. UTF-8 is a variable-width encoding where a single character can be represented by one to four bytes.

If a percent-encoded string is cut off or contains incomplete sequences, the decoder cannot resolve the bytes into valid characters. For example, a broken sequence such as %E0%A4%A is incomplete and cannot be decoded. When the tool encounters an invalid or incomplete sequence, it stops the operation and displays the error message: "This URL text has a broken percent escape.".

Encoding and Escaping vs. Security Sanitization

It is important to distinguish between encoding or escaping and security sanitization.

  • Encoding and Escaping: These are structural transformations. They ensure that data is syntactically valid for a specific context, such as a URL query string or an HTML text block. They prevent parsing errors and ensure characters render exactly as intended.
  • Security Sanitization: This is the process of cleaning untrusted input to prevent security vulnerabilities, such as Cross-Site Scripting (XSS) or SQL injection. While HTML escaping helps prevent XSS by ensuring user input is treated as text rather than executable code, escaping alone does not replace a comprehensive security sanitization pipeline, which may involve stripping dangerous tags, validating input schemas, or using parameterized database queries.

Practical Applications in Web Development

Developers, content editors, and support personnel frequently encounter scenarios that require encoding, decoding, escaping, or unescaping:

  • Query Parameters: When building search features, developers must encode user-entered search terms (e.g., hello world & city=上海) into a safe format (e.g., hello%20world%20%26%20city%3D%E4%B8%8A%E6%B5%B7) so the server receives the parameters correctly.
  • Embedding Code Snippets: Content editors who write technical documentation use HTML escaping to display raw HTML code blocks on a webpage without the browser executing the code.
  • Troubleshooting URLs: Support personnel often receive encoded URLs from log files or API payloads. Decoding these URLs makes the parameters readable, allowing them to diagnose issues quickly.

Local Browser Processing and Privacy

This tool processes all conversions locally within your web browser. Your URL and HTML text is converted in your browser, and nothing is uploaded to BroBroGo. This local execution ensures that your input data remains within your local environment during processing.

Frequently Asked Questions

Should I choose URL component or full URL?

Use component for query values, path pieces, or form values. Use full URL when you want to keep characters such as: /? & = readable.

What does HTML entity escaping change?

It turns characters such as <, >, &, quotes and non-ASCII text into entities that can be pasted safely into HTML text or attributes.

Why does URL decoding sometimes fail?

Percent escapes must be complete UTF-8 sequences. A broken sequence such as %E0%A4%A cannot be decoded without guessing.