CruxDevCruxDev Tools Prompts
dev Utility • Zero-Server Privacy • 100% Client-Side

URL Encoder/Decoder

Encode special characters for safe URL usage, or decode percent-encoded strings.

Overview

Percent-encodes and decodes text using encodeURIComponent and decodeURIComponent, the pair you want when building or reading a single query parameter value rather than a whole URL.

How It Works

Toggle between encode and decode; the conversion runs as you type. Decoding invalid input does not silently produce garbage. A malformed percent sequence returns "Error: Invalid or malformed URL encoding string." so you can see the data was already broken upstream rather than assuming the tool failed.

Step-by-Step Usage Guide

  1. Paste the raw text, or the already-encoded string.
  2. Choose encode or decode.
  3. Read the result and copy it into your request, config, or test case.

Technical Specifications & Standards

The important distinction is encodeURIComponent versus encodeURI. encodeURIComponent escapes the reserved delimiters &, =, ?, /, #, + and :, which is correct for a value going inside a parameter. encodeURI leaves them intact because it assumes a complete URL. Using encodeURI on a parameter value is how an ampersand inside user text ends up splitting one parameter into two, which is both a data-corruption and an injection path. Note also that a literal + means a space under form encoding but a plus sign under strict percent-encoding, which is why encodeURIComponent emits %20 rather than +.

Targeted Use Cases

  • Escaping a search term, email address, or redirect target before appending it to a query string.
  • Reading a callback or return_to parameter out of an OAuth redirect to see where it actually points.
  • Decoding a logged URL to find the character that broke a route match.
  • Checking what a value looks like when a proxy has encoded it twice.

Notes & Gotchas

  • Encode each parameter value separately, then assemble the URL. Encoding the assembled URL escapes the delimiters you needed.
  • %25 is an encoded percent sign. Seeing %2520 instead of %20 means the value was encoded twice, so decode again.
  • Spaces become %20 here. If a system expects the form-encoded + convention, convert after encoding.
  • The fragment after # never reaches the server, so encoding problems there are purely client-side.

Frequently Asked Questions

Which functions does this use?

encodeURIComponent for encoding and decodeURIComponent for decoding, the component-level pair rather than encodeURI.

Why did decoding return an error?

The input contains a percent sign not followed by two valid hex digits. That is invalid percent-encoding, so the error reflects broken input rather than a tool limitation.

Can it handle non-Latin characters and emoji?

Yes. They are encoded as UTF-8 bytes, so one character often becomes several percent-escaped bytes.

Is the text uploaded?

No, the transformation runs in your browser.