URL Encoder / Decoder

Encode or decode URLs with percent-encoding. Supports encodeURIComponent and encodeURI. Free, private, browser-based. Free online tool, no sign-up.

How to use

  1. Choose Mode — Select Encode to percent-encode text, or Decode to restore encoded text
  2. Enter Input — Paste text or a URL-encoded string
  3. Convert & Copy — Click to process, then copy the result

What Is URL Encoding?

URL encoding, also called percent-encoding, is a mechanism for encoding characters that have special meaning in URLs or are not allowed in the URL specification (RFC 3986). Each unsafe character is replaced with a percent sign (%) followed by its two-digit hexadecimal representation.

For example, a space becomes %20, an ampersand becomes %26, and a Japanese character like "東" becomes %E6%9D%B1 (its UTF-8 bytes in hex).

Why URL Encoding Matters

URLs have a strict syntax where certain characters have special meanings: ? starts the query string, & separates parameters, # marks a fragment, and / separates path segments. If user data contains these characters and isn't encoded, the URL breaks.

  • Query parameters: A search query containing "&" would create a false parameter boundary
  • Path segments: A filename with "/" would create false directory levels
  • International characters: Non-ASCII characters must be encoded for URL compatibility
  • Security: Proper encoding prevents URL injection attacks

encodeURIComponent vs encodeURI

JavaScript provides two encoding functions with different scopes:

  • encodeURIComponent: Encodes everything except A-Z a-z 0-9 - _ . ~. Use for individual query parameter values.
  • encodeURI: Preserves URL structure characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Use for encoding a complete URL.

This tool provides both: the main encode button uses encodeURIComponent (safest for parameter values), and the "Encode Full URL" button uses encodeURI.

Common Characters and Their Encodings

Space: %20, Ampersand: %26, Equals: %3D, Plus: %2B, Slash: %2F, Question mark: %3F, Hash: %23, At sign: %40.

Double Encoding

A common mistake is encoding a string that's already encoded, producing double-encoded values like %2520 (the % in %20 gets encoded to %25). Use the decode function to check if a string is already encoded before encoding it again.

Privacy

All encoding and decoding happens in your browser using JavaScript's native functions. No data is sent to any server. You can safely encode URLs containing tokens, credentials, and private parameters.

Encode data for transport with our Base64 Encoder. Escape HTML characters with our HTML Entity Encoder.

Frequently asked questions

What is URL encoding?

URL encoding (percent-encoding) replaces unsafe characters with a '%' followed by two hex digits. For example, a space becomes %20, and '&' becomes %26. This ensures special characters don't break URL structure.

What's the difference between encodeURI and encodeURIComponent?

encodeURI encodes a full URL, preserving characters like :, /, ?, #, and &. encodeURIComponent encodes everything except letters, digits, and - _ . ~ — use it for query parameter values.

When should I URL-encode?

Always encode user-provided values before inserting them into URLs. This prevents URL injection, broken links, and ensures special characters like spaces and ampersands are transmitted correctly.

Is my data safe?

Yes. All encoding and decoding runs locally in your browser using JavaScript's built-in functions. No data is transmitted to any server.

Related free tools

  • XML Formatter & Minifier — Beautify or minify any XML — SOAP, RSS, SVG, sitemap. Browser-based parser.
  • XML to JSON Converter — Parse any well-formed XML into a clean JSON tree with attributes and arrays.
  • JSON to XML Converter — Convert JSON to well-formed XML — supports attributes, custom root, declaration.
  • CSV Viewer — Open CSV or TSV files in your browser — sort, search, paginate, export filtered view.
  • JSON to CSV Converter — Convert JSON data to CSV format. Export to spreadsheets easily.
  • CSV to JSON Converter — Convert CSV data to JSON format. Useful for API development.
  • JSON Formatter — Format, beautify, or minify JSON with customizable indentation.
  • JSON Validator — Validate JSON syntax and find errors with line and column numbers.
  • HTML Minifier — Compress HTML by removing comments, whitespace, and line breaks.
  • CSS Minifier — Minify CSS by stripping comments, whitespace, and unnecessary characters.
  • JavaScript Minifier — Compress JavaScript by removing comments, whitespace, and empty lines.
  • Base64 Encoder/Decoder — Encode text to Base64 or decode Base64 back to text. UTF-8 support.

Browse all free tools · Guides and tutorials · PDF tools · Developer tools · Text tools · SEO tools