Developer Tools4 min read•October 8, 2026

How to Percent-Encode and Decode URL Query Strings Without Breaking Links

Learn how to encode spaces, ampersands and slashes into safe percent sequences, decode encoded URIs back to text, and copy the result in one click.

S
SmartToolPack Dev Desk✓ Verified
Reviewed by the GreenCode Developer Tools Editorial Desk
Last Updated: October 8, 2026
Disclaimer: Calculations and results provided by this tool are mathematical estimates for informational and educational purposes only. They do not constitute professional financial, tax, or legal advice.
Featured Utility Tool

URL Encoder / Decoder

Open URL Encoder / Decoder

Introduction

Spaces, ampersands and other reserved characters in a URL parameter can split a query or be misread by a server. The URL Encoder / Decoder applies encodeURIComponent to turn text into percent-encoded form, or decodeURIComponent to read an encoded string back. Processing is done in the browser on every keystroke.

Step-by-Step Instructions

  1. Click Encode URL or Decode URL at the top of the panel to set the direction.
  2. Paste the text or encoded string into the Input String box.
  3. Read the Processed Output box, which updates immediately as the input changes.
  4. Switch the mode button if the result looks wrong; the existing input is reprocessed in the new direction.
  5. Click Copy Result to copy the output to the clipboard.

Key Use Cases

  • Query parameters: Encode a search phrase containing spaces and ampersands before appending it to a URL.
  • Redirect URLs: Encode a full callback URL so it can be passed as a single parameter value.
  • Debugging: Decode an encoded string from a log or analytics report to see the original text.

Frequently Asked Questions

Why are the colon and slashes in my URL encoded too?

Encode mode uses encodeURIComponent, which escapes every reserved character including : / ? and &. That is correct when the text will be placed inside a single parameter value. To encode only the unsafe characters in a whole URL while keeping its structure, encode each parameter value separately.

Does it encode as %20 or as a plus sign?

Spaces become %20, following RFC 3986 component encoding. The plus sign convention belongs to application/x-www-form-urlencoded form bodies and is not applied here, so a plus in the input is itself encoded as %2B.

What does Error decoding URI sequence mean?

Decode mode calls decodeURIComponent, which throws on a malformed percent sequence such as a lone % or %ZZ. The output box shows that error text instead of partial output. Check that the input was copied completely and was not double-encoded or truncated.