URL Encoder / Decoder
Encode and decode URL components with percent-encoding instantly.
Convert special characters to their HTML entity equivalents or decode entities back to readable text. Protect your markup from rendering bugs and XSS vulnerabilities with one click.
HTML entities are special character sequences that represent reserved characters in HTML. Characters like <, >, & and quotation marks have syntactic meaning in HTML markup, so when you want to display them as visible text on a web page, you must replace them with entity references. For example, the ampersand character is written as & and the less-than sign as <. Without this encoding, the browser would interpret these characters as HTML tags or attribute delimiters, breaking your layout or creating security holes.
There are two forms of HTML entities: named and numeric. Named entities like &, < and © use human-readable labels and are easy to recognize in source code. Numeric entities use the Unicode code point of the character in either decimal (&) or hexadecimal (&) notation. While only a subset of Unicode characters have named entities, numeric entities can represent any character in the Unicode standard, including emoji and symbols from non-Latin scripts.
Encoding HTML entities is a critical defense against cross-site scripting (XSS) attacks. When user-generated content is inserted into a page without proper encoding, an attacker can inject malicious script tags that execute in other users' browsers. By converting every < and > to their entity equivalents before rendering, you ensure that untrusted input is treated as inert text rather than executable code. Modern templating engines handle this automatically, but understanding the underlying mechanism is essential for any web developer.
& and end with ;, used to represent characters that have special meaning in HTML or that cannot be typed directly. The five most essential entities are & (ampersand), < (less-than), > (greater-than), " (double quote) and ' (apostrophe). They ensure that these characters are displayed as text rather than parsed as HTML syntax.<pre> or <code> blocks, inserting values into HTML attributes, and adding typographic symbols like the copyright sign or em dash. Most importantly, encoding untrusted input prevents XSS attacks by ensuring injected markup is rendered as harmless text.& for the ampersand), while numeric entities use the Unicode code point in decimal (&) or hexadecimal (&) form. Named entities are more readable but only cover a subset of characters. Numeric entities can represent any Unicode character, making them necessary for symbols and scripts that lack a named equivalent. Browsers decode both forms identically.< and > would be parsed as HTML tags, potentially breaking your page layout or creating security vulnerabilities. Encoding is especially critical when displaying user-generated content, because it neutralizes any injected script tags or malicious markup.& for the ampersand and < for less-than, making them easy to read in source code. Numeric entities use the character's Unicode code point in decimal (&) or hexadecimal (&) form and can represent any Unicode character. Named entities are limited to a predefined subset, while numeric entities cover the entire Unicode standard. Browsers render both forms identically.&), less-than (<), greater-than (>), double quote ("), and single quote ('). Other characters like letters, digits, and common punctuation are safe to use as-is. However, encoding non-ASCII characters like accented letters or symbols can improve compatibility across different systems and encodings.<script> tags is rendered without encoding, the browser executes the injected code, potentially stealing cookies, session tokens, or personal data. HTML entity encoding converts < and > to < and >, ensuring that any injected markup is displayed as harmless text rather than executed as code.