URL & HTML Encoder / Decoder / Slugify
A versatile tool to encode/decode text for URLs and HTML, or to create clean, URL-friendly slugs from any string.
This multi-purpose utility is an essential part of any web developer's or content creator's toolkit. It handles common text transformations required for web contexts, from making text safe to include in a URL to creating user-friendly URL slugs for SEO. Because every operation runs entirely in your browser using JavaScript, your data is processed instantly and remains completely private. No information is ever sent to a server.
URL Encoding & Decoding
URLs can only contain a specific set of characters. URL encoding (or percent-encoding) converts reserved characters (like spaces, '&', '?') and non-ASCII characters into a format that can be safely transmitted over the internet. Decoding reverses this process. Our tool offers two modes:
- encodeURIComponent (default): Encodes everything. Use this when you are encoding a single part of a URL, like a search query or a parameter value.
- encodeURI: A less aggressive option that leaves special URL characters like ?, =, &, and # un-encoded. Use this only when you need to encode a full, existing URL that already contains these characters.
HTML Encoding & Decoding
HTML encoding (or escaping) converts characters that have special meaning in HTML (like `<` and `>`) into their corresponding HTML entities (e.g., `<` and `>`). This is crucial for security, as it prevents user-provided text from being accidentally rendered as HTML, which could lead to XSS attacks. Decoding reverses this process, turning entities back into their original characters.
Slugify
This function creates a clean, SEO-friendly "slug" from any string. A slug is the part of a URL that identifies a page. For example, in `example.com/blog/my-first-post`, the slug is `my-first-post`. The slugify process involves converting the text to lowercase, removing accents and special characters, and replacing spaces with a delimiter (usually a hyphen).