Encode and decode HTML entities, special characters, and URLs
Convert text to HTML entities or URL encoding
Encode and decode HTML entities and URLs
Choose between 'Encode' (text to HTML/URL) or 'Decode' (HTML/URL to text).
Type or paste your text (for encoding) or encoded string (for decoding).
Click 'Encode HTML' for HTML entities or 'Encode URL' for URL encoding.
Click the copy button to copy the result to your clipboard.
Cross-Site Scripting (XSS) is a common vulnerability where attackers inject malicious scripts into web pages. Encoding converts special characters like `<` into `<` and `>` into `>`.
Example: If a user inputs `<script>alert('hack')</script>`, encoding it ensures the browser displays the text safely instead of executing the script code.
URL encoding (or Percent-encoding) converts characters into a format that can be transmitted over the Internet. URLs can only contain ASCII characters from the standard 128-character set. Special characters, spaces, and non-ASCII characters must be encoded. For example, a space becomes '%20' or '+'. This tool ensures your URLs are valid and safe for transmission.
Some of the most frequently used HTML entities include:
While both processes involve converting characters, they serve different purposes. HTML encoding is for safely displaying text within a web page's HTML structure. URL encoding is for safely including data within a URL (e.g., in query parameters). Using the wrong encoding can lead to broken links or security vulnerabilities.
Cross-Site Scripting (XSS) is a major security vulnerability where attackers inject malicious scripts into trusted websites. HTML encoding is your first line of defense. By encoding user input before rendering it (e.g., converting `<script>` to `<script>`), you neutralize the script tags, preventing them from executing in the user's browser.
In JavaScript, there's a key difference: