RFC 3986 • WHATWG HTML5
Coding

URL & HTML Entity Encoder/Decoder

RFC 3986HTML5 Entities
Flavor:
Hex:

Raw Input String

129 chars•1 lines•131 B
Mode: URL

Transformed Result

183 chars•183 B
142% of input length
RFC 3986 & WHATWG HTML5 Standards

Technical Guide to URL Percent-Encoding, RFC 3986, and HTML5 Entity Sanitization

Standardized by the IETF under RFC 3986 ("Uniform Resource Identifier: Generic Syntax") and maintained by the WHATWG URL Standard, percent-encoding represents arbitrary octets and characters within the restricted US-ASCII subset permitted in URLs. Concurrently, HTML entity encoding protects web applications against Cross-Site Scripting (XSS) by preventing untrusted strings from being interpreted as active DOM elements.

1. encodeURIComponent (Query Parameter Mode)

Escapes all characters except: A-Z a-z 0-9 - _ . ! ~ * ' ( ). Characters with structural roles such as &, =, ?, and / are encoded into percent triplets. Use this mode whenever encoding individual query parameter keys and values.

2. encodeURI (Complete URI Mode)

Escapes characters that are invalid in complete addresses while preserving protocol scheme separators, path hierarchies, and query markers: ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #. Use this mode when you have an entire URL string with non-ASCII characters in the pathname that you want to render valid without breaking the protocol or slashes.

RFC 3986 Character Classification Matrix

RFC 3986 divides the character universe into unreserved, reserved, and percent-encoded subsets:

Unreserved Characters (§2.3)

Characters that have no reserved structural meaning in any URL scheme:

A-Z, a-z, 0-9, "-", ".", "_", "~"
Reserved Delimiters (§2.2)

Characters reserved for grammar boundaries (schemes, paths, queries, fragments):

":", "/", "?", "#", "[", "]", "@", "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="

Space Encoding: RFC 3986 (%20) vs. Form-Urlencoded (+)

In generic URI syntax under RFC 3986, spaces are percent-encoded as %20. In contrast, the HTML specification for form submissions (application/x-www-form-urlencoded) encodes spaces as +. PrivaUtils provides a dedicated toggle to support both specifications.

HTML5 Character Entity Reference Matrix

When inserting dynamic content into HTML, raw characters must be replaced with entities to prevent XSS injection:

CharacterNamed EntityDecimal EntityHexadecimal EntitySecurity Description
&&&&Entity reference delimiter
<&lt;&#60;&#x3C;Tag opener
>&gt;&#62;&#x3E;Tag closer
"&quot;&#34;&#x22;Attribute value quote
'&#39;&#39;&#x27;Single quote attribute delimiter
©&copy;&#169;&#xA9;Copyright symbol
🚀(none)&#128640;&#x1F680;Astral plane Unicode emoji

Implementation Guide by Programming Language

Standard methods for URL and HTML encoding across backend and database platforms:

LanguageURL Encode MethodURL Decode MethodHTML Encode Method
JavaScriptencodeURIComponent(s)decodeURIComponent(s)DOM / regex replace
Pythonurllib.parse.quote(s)urllib.parse.unquote(s)html.escape(s)
C# (.NET)Uri.EscapeDataString(s)WebUtility.UrlDecode(s)WebUtility.HtmlEncode(s)
PHPrawurlencode($s)rawurldecode($s)htmlspecialchars($s)
JavaURLEncoder.encode(s, "UTF-8")URLDecoder.decode(s, "UTF-8")StringEscapeUtils.escapeHtml4
SQL ServerFOR XML PATH('')REPLACE / XML .valueFOR XML PATH

Frequently Asked Questions (FAQ)

Does this tool support multi-byte Unicode strings and emojis?

Yes. All strings are processed using ECMAScript UTF-8 encoders and String.fromCodePoint(), guaranteeing that emojis, Cyrillic, Chinese Hanzi, and math symbols are properly percent-encoded into octet sequences and HTML entities without surrogate pair truncation.

How does PrivaUtils handle malformed percent-encoded sequences?

When input text contains an incomplete or invalid percent token (such as a trailing % or illegal hex digits), PrivaUtils identifies the exact character index and token marker, displaying an informative diagnostic rather than throwing an unhandled exception.

How does PrivaUtils save tool settings?

Your preferences (default mode, space format, line-by-line batch mode, and entity format) are stored in your browser's IndexedDB under the url-encoder-settings key. You can inspect, export, import, or clear them at any time in the Privacy Vault.

Related Privacy Utilities

Peer tools running locally in your browser memory without server uploads.

Explore all utilities