Skip to content

URL Encoder & Decoder

Percent-encode or decode text and URLs, and break any URL into its parts and parameters.

Runs in your browser. Nothing is uploaded.

Text to decode

Direction
Mode

Decoded

127 characters
https://example.my.salesforce.com/services/data/v62.0/query?q=SELECT Id, Name FROM Account WHERE Name = 'Acme & Sons'&batch=200

URL parts

Scheme
https
Host
example.my.salesforce.com
Path
/services/data/v62.0/query

Query parameters (2)

q
SELECT Id, Name FROM Account WHERE Name = 'Acme & Sons'
batch
200

How to use the URL Encoder & Decoder

  1. Choose Encode or Decode.
  2. Pick how to encode: a single value (component), a whole URL, or a form value with β€œ+” for spaces.
  3. Type or paste text. The result updates as you type.
  4. When the text is a full URL, its scheme, host, path and every query parameter are listed below.

Why URLs need encoding

A URL can only contain a limited set of characters, and some of them have jobs: ? starts the query, & separates parameters and = separates a name from its value. To send a value that contains these characters, or spaces and non-English letters, each unsafe byte is written as % followed by two hexadecimal digits. A space becomes %20, and Γ© becomes %C3%A9.

Which mode to use

  • Component: for one value going into a URL, such as a search term or a record name. Encodes everything except letters, digits and -_.!~*'().
  • Whole URL: for a complete address that may contain spaces. Leaves :/?#&= alone so the URL keeps its structure.
  • Form: for application/x-www-form-urlencoded bodies and Apex. Spaces become +.

URL encoding in Apex

Apex
String q = EncodingUtil.urlEncode('Acme & Sons', 'UTF-8');   // Acme+%26+Sons
req.setEndpoint('callout:Search_API/accounts?name=' + q);

String original = EncodingUtil.urlDecode(q, 'UTF-8');         // Acme & Sons

Encode each value separately, never the whole URL: encoding the whole URL would also encode the ? and & that give it structure.

Features and limitations

What it does

  • Three encodings: encodeURIComponent, encodeURI and application/x-www-form-urlencoded.
  • Form mode produces exactly what Apex EncodingUtil.urlEncode(value, 'UTF-8') returns.
  • Decoding explains malformed percent-sequences and where they are.
  • Breaks any URL into its parts and decodes every query parameter, including repeated ones.
  • Full UTF-8 support for accented letters, other alphabets and emoji.

What it does not do

  • Encoding is not encryption; anyone can decode the result.
  • It does not shorten URLs or check whether they work.
  • Internationalised domain names are shown as the browser parses them, which may be in punycode.

Questions about the URL Encoder & Decoder

Inside a URL path, use %20. In query strings and form bodies, both are usually accepted; + is the form-encoding convention and what Apex produces.

A β€œ%” must be followed by two hexadecimal digits, and the bytes must form valid UTF-8. A lone β€œ%”, or text encoded with an old character set, causes this error.

No. Encoding, decoding and URL parsing run in your browser. URLs often contain tokens and IDs; they never leave your device.

Yes. Component and whole-URL modes use encodeURIComponent and encodeURI directly.

Yes. Paste the URL in either mode; when it is a complete URL, every query parameter is listed with its decoded value.