Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Tech & Development Calculators
  3. /String & Text Transformation Calculators
  4. /URL Encoder/Decoder

URL Encoder/Decoder

Calculator

Results

Needs Percent-Encoding

1

Decimal Value

64

High Hex Nibble (0-F)

4

Low Hex Nibble (0-F)

0

Encoded Length (%XX)

3

chars

Results

Needs Percent-Encoding

1

Decimal Value

64

High Hex Nibble (0-F)

4

Low Hex Nibble (0-F)

0

Encoded Length (%XX)

3

chars

The URL Encoder/Decoder Calculator analyzes ASCII character codes to determine whether they require percent-encoding for safe inclusion in URLs. Percent-encoding (also called URL encoding) is a fundamental mechanism of the World Wide Web, defined in RFC 3986, that allows special characters to be transmitted safely in URLs by representing them as a percent sign followed by two hexadecimal digits.

Every URL you see in your browser relies on percent-encoding to handle characters that have special meaning in URL syntax or that fall outside the allowed character set. When you search for 'hello world' on Google, the space becomes %20 in the URL: ?q=hello%20world. When you share a URL containing an ampersand, it becomes %26 to avoid being interpreted as a query parameter separator.

The ASCII character set (0-127) is divided into distinct groups for URL encoding purposes. Unreserved characters (A-Z, a-z, 0-9, hyphen, period, underscore, tilde) can appear in URLs without any encoding. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have special meaning in URL syntax and must be percent-encoded when used as data rather than delimiters. Unsafe characters (spaces, control characters, non-ASCII) must always be encoded.

This calculator takes an ASCII code (0-127) and determines whether the character requires percent-encoding according to RFC 3986. It also computes the hexadecimal representation used in the percent-encoded form. For example, the space character (ASCII 32) encodes to %20 because 32 in hexadecimal is 20 (high nibble = 2, low nibble = 0).

Understanding URL encoding is essential for web developers, API designers, and security professionals. Improper URL encoding is a common source of bugs: broken links from unencoded spaces, security vulnerabilities from unencoded special characters, and data corruption from double-encoding. Cross-site scripting (XSS) attacks often exploit inconsistent URL encoding to inject malicious code through query parameters.

For API development, URL encoding affects request URL length. Each encoded character expands from 1 byte to 3 bytes (%XX), potentially tripling the URL length for non-ASCII text. Most web servers impose URL length limits (Apache: 8,190 bytes, IIS: 16,384 bytes), making it crucial to understand how encoding affects URL size when designing query parameter schemas.

Modern programming languages provide built-in URL encoding functions: JavaScript's encodeURIComponent(), Python's urllib.parse.quote(), PHP's urlencode(), and Java's URLEncoder.encode(). However, these functions have subtle differences in which characters they encode, making manual understanding of the RFC 3986 rules essential for interoperability.

Visual Analysis

How It Works

The calculator determines encoding necessity by checking if the ASCII code falls within the unreserved character set defined in RFC 3986:

$$\text{unreserved} = \{A\text{-}Z\} \cup \{a\text{-}z\} \cup \{0\text{-}9\} \cup \{\text{-}, \text{.}, \_, \sim\}$$

Characters outside this set require percent-encoding. The encoding converts the decimal ASCII value to two hexadecimal digits:

$$\text{hex\_high} = \lfloor \text{ascii\_code} / 16 \rfloor \quad \text{hex\_low} = \text{ascii\_code} \mod 16$$

The percent-encoded form is % followed by the high and low hex nibbles. An encoded character always occupies exactly 3 bytes versus 1 byte unencoded.

Understanding Your Results

Needs Percent-Encoding: 1 means the character must be encoded in URLs; 0 means it can appear as-is. Decimal Value: the raw ASCII code. High/Low Hex Nibbles: the two hexadecimal digits that form the %XX encoding (values 0-15, where 10=A, 11=B, ..., 15=F). Encoded Length: 3 for encoded characters (%XX), 1 for unreserved characters. Use these results to predict URL length expansion when encoding strings with special characters.

Worked Examples

Space Character (ASCII 32)

Inputs

ascii code32
is reserved0

Results

needs encoding1
percent value32
hex high2
hex low0
encoded length3

Space (ASCII 32) → %20: hex high=2, low=0, expands from 1 to 3 chars

Letter 'A' (ASCII 65)

Inputs

ascii code65
is reserved0

Results

needs encoding0
percent value65
hex high4
hex low1
encoded length1

Letter A (ASCII 65) is unreserved — no encoding needed, stays as 1 char

Frequently Asked Questions

URL encoding replaces unsafe characters with a percent sign followed by two hex digits representing the character's ASCII value. Space (32) becomes %20, ampersand (38) becomes %26. This ensures special characters are transmitted correctly in URLs.

All characters except unreserved ones (A-Z, a-z, 0-9, -, ., _, ~) need encoding when used as data in URLs. Reserved characters (: / ? # @ ! $ & ' * + , ; = [ ]) need encoding when they appear as literal data rather than URL structural delimiters.

The space character has ASCII code 32. In hexadecimal, 32 = 2×16 + 0 = 20. Percent-encoding prefixes the hex value with %, giving %20. Similarly, @ (ASCII 64) = 4×16 + 0 = %40.

Both represent spaces, but in different contexts. %20 is used in URL paths per RFC 3986. The + sign represents spaces in query strings per the application/x-www-form-urlencoded format (HTML forms). Modern best practice favors %20 everywhere.

Double encoding occurs when an already-encoded string is encoded again: %20 becomes %2520 (the % is re-encoded as %25). This is a common bug that breaks URLs. Always check if a string is already encoded before encoding it.

Each encoded character expands from 1 byte to 3 bytes. A URL with 10 spaces grows by 20 bytes. For non-ASCII UTF-8 characters, each byte of the multi-byte encoding is individually percent-encoded, potentially expanding a single character to 9+ bytes.

The hex digits in percent-encoding can be uppercase or lowercase (%2F and %2f are equivalent), but RFC 3986 recommends uppercase. Unreserved characters should not be encoded at all — encoding 'A' as %41 is valid but unnecessary and not recommended.

Non-ASCII characters (like unicode letters) are first encoded as UTF-8 bytes, then each byte is percent-encoded. The character e with acute accent (U+00E9) becomes %C3%A9 (two UTF-8 bytes, each percent-encoded). This is called IRI (Internationalized Resource Identifier) encoding.

encodeURI() encodes spaces and non-ASCII but preserves URL structure characters (: / ? #). encodeURIComponent() encodes everything except unreserved characters, suitable for query parameter values. Always use encodeURIComponent() for user input in query strings.

Proper URL encoding is one layer of defense against XSS. Encoding < as %3C and > as %3E prevents them from being interpreted as HTML tags. However, URL encoding alone is insufficient — output encoding must match the context (HTML, JavaScript, CSS, URL).

Sources & Methodology

RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax; RFC 2396; W3C URL Standard; OWASP URL Encoding Guide
R

Roboculator Team

The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.

How helpful was this calculator?

Be the first to rate!

Related Calculators

Case Converter

String & Text Transformation Calculators

camelCase Converter

String & Text Transformation Calculators

snake_case Converter

String & Text Transformation Calculators

kebab-case Converter

String & Text Transformation Calculators

Slugify Converter

String & Text Transformation Calculators

Text to Binary Converter

String & Text Transformation Calculators