URL Encoder

Percent-encode a value so it can sit safely inside a URL. Spaces, ampersands, slashes and other special characters become %-codes, using the browser's encodeURIComponent.

Updated

Developer Tools● Free No upload Instant

Loading URL Encoder…

Your browser is preparing the tool. It runs 100% locally.

Quick answer

Paste text and the tool percent-encodes it with the browser's encodeURIComponent. Spaces, slashes, ampersands, question marks and other special characters become %-codes, so they can travel inside a URL without breaking it. It encodes one piece, such as a query value, and not a whole URL: the slashes and colon of a full address get encoded too. Non-English letters become their UTF-8 %-bytes. The encoding happens in your browser.

What the URL Encoder does

Type or paste a value and you get its percent-encoded form, ready to drop into a query string or path segment. A space becomes %20, a slash becomes %2F and an ampersand becomes %26. Any character with a special meaning in a URL is replaced by a percent sign and its hex code, so the value cannot break the link it sits in.

It encodes a component, not a complete URL. It escapes the reserved characters that separate the parts of a URL (the slashes, colon, question mark and ampersand), so a whole address run through it has those separators encoded as well. That is what you want for a single value and wrong for a finished URL.

How it works

The tool runs your text through JavaScript's encodeURIComponent. That function leaves the unreserved characters alone: the letters A to Z, the digits, the hyphen, underscore, dot and tilde, plus the exclamation mark, apostrophe, parentheses and star. It percent-encodes everything else, including the reserved characters that structure a URL.

Characters outside ASCII are first converted to their UTF-8 bytes, and each byte is encoded separately. So an accented é becomes %C3%A9 (two bytes), and an emoji becomes four %-codes. Decoding reverses the process and reassembles the original character.

Data source & conversion logic

  1. Read the text. Take whatever you typed or pasted, as a single value.
  2. Keep unreserved characters. Leave letters, digits, the hyphen, underscore, dot and tilde, and also the exclamation mark, apostrophe, parentheses and star, as they are.
  3. Percent-encode the rest. Replace every other character, including spaces and reserved URL characters, with a percent sign and its hexadecimal code.
  4. Encode non-ASCII as UTF-8. Convert characters beyond ASCII to UTF-8 bytes and encode each byte.

What it encodes

space → %20 slash → %2F question mark → %3F equals → %3D ampersand → %26 accented é → %C3%A9 (UTF-8 bytes)
Worked example
a/b?c=d → a%2Fb%3Fc%3Dd

Letters, digits and the symbols hyphen, underscore, dot, tilde, exclamation mark, apostrophe, parentheses and star are left as they are. Everything else is percent-encoded. The input is treated as one value, not a whole URL.

Privacy

A built-in JavaScript function encodes your text in your browser and sends nothing to a server, so values that contain private data can be encoded here.

Percent-encoding is not encryption. Anyone can reverse it, so use it to carry characters safely and not to keep anything secret.

Technical details

MethodencodeURIComponent (browser built-in)
Encodesreserved characters, spaces, non-ASCII
Leaves aloneletters, digits, hyphen, underscore, dot, tilde, and ! ' ( ) *
Space becomes%20 (not a plus sign)
Non-ASCIIUTF-8 bytes, each percent-encoded
Scopeone value or component, not a whole URL
Where it runsIn your browser; the text is not sent anywhere

Standards and references

  • Percent-encoding (RFC 3986): RFC 3986 defines unreserved characters (letters, digits, hyphen, underscore, dot, tilde) that need no encoding, and reserved characters that must be encoded when they appear as data instead of as delimiters.
  • encodeURIComponent: the JavaScript function this tool uses. It encodes the reserved characters (slash, question mark, ampersand, equals and the rest). encodeURI leaves them alone because it is meant for whole URLs.
  • UTF-8 for non-ASCII: characters beyond ASCII are encoded as their UTF-8 bytes, so one accented or non-Latin character can become several percent-codes.

Accuracy and limits

It encodes a single component, not a whole URL. Run a complete address like the home page of a site through it and the slashes and colon become %2F and %3A, which breaks the URL. Encode individual values (a search term, a parameter) and build the URL around them.

A space becomes %20, not a plus sign. HTML form submissions use a plus for a space in the query string; if you need that form, replace %20 with a plus yourself after encoding.

encodeURIComponent leaves a few sub-delimiters unencoded: the exclamation mark, apostrophe, parentheses and star, even though RFC 3986 lists them as reserved. Most systems accept this. If a strict parser needs them encoded, handle those characters separately.

Percent-encoding hides nothing, because anyone can decode it. Do not use it to protect passwords, tokens or other secrets.

Encoding the same text twice double-encodes it: a percent sign from the first pass becomes %25 on the second. Encode once, and decode the matching number of times.

Real-world uses

Query parameters

Encode a search term or value before adding it to a URL.

API requests

Safely place user input into a path segment or query string.

Building links

Encode a redirect or campaign value carried inside another URL.

Debugging

See how a value will look once it is encoded in a request.

When it fits, and when it doesn't

Good for

  • Encoding a single query value or path segment
  • User input going into a URL
  • Spaces and special characters in parameters
  • Seeing the percent-encoded form of a value

Not the best choice for

  • Encoding a whole, finished URL
  • Producing the plus-for-space form directly
  • Hiding or securing data (it is reversible)
  • Strict RFC encoding of the ! ' ( ) * characters

Encoding a complete, well-formed URL? encodeURI, a whole-URL encoder, leaves the separators intact. Need the plus-for-space form? Swap %20 for a plus after encoding. To reverse the process, use the URL decoder.

Frequently asked questions

What is URL encoding?
Also called percent-encoding, it replaces characters that have a special meaning in a URL, or that a URL cannot contain, with a percent sign and a hex code. A space becomes %20, for example, so the value can sit inside the link without breaking it.
Why did my slashes and colons get encoded?
This tool encodes a single value with encodeURIComponent, which escapes the reserved characters that separate URL parts. That is correct for a parameter. For a whole URL, encode the individual values instead of the full address.
What is the difference from encodeURI?
encodeURI is for a whole, well-formed URL and leaves the separators (slash, colon, question mark, ampersand) alone. encodeURIComponent, used here, encodes those too, because it is meant for one component that will sit inside a URL.
Why is a space %20 and not a plus?
encodeURIComponent uses %20 for a space. The plus-for-space convention belongs to HTML form submissions (the form-urlencoded format). If you need a plus, replace %20 after encoding.
What happens to accented or non-English characters?
They are converted to UTF-8 bytes and each byte is percent-encoded, so an é becomes %C3%A9 and many emoji become four codes. Decoding reassembles the original character.
Is URL encoding the same as encryption?
No. Anyone can decode it, so it hides nothing. Use it to carry characters safely in a URL and never to protect secrets.
Which characters are left unencoded?
The unreserved set (letters, digits, hyphen, underscore, dot and tilde) plus a few sub-delimiters that encodeURIComponent skips: the exclamation mark, apostrophe, parentheses and star.
What if I encode something twice?
It double-encodes. The percent signs from the first pass become %25 on the second, so the result is wrong until you decode it the same number of times. Encode once.
Can I encode a whole URL with this?
You can, but the separators get encoded too, which breaks the URL. Encode each value separately and build the URL around them, or use a whole-URL encoder for a finished address.
Does it change letters or numbers?
No. Plain letters A to Z, digits, and the safe symbols are left exactly as they are. Only special and non-ASCII characters are encoded.
Is my text uploaded?
No. Your browser encodes the text with a built-in function and sends nothing anywhere.
How is a percent sign in my input encoded?
A literal percent sign becomes %25. That is why double-encoding causes trouble: a second pass encodes the percent signs the first pass created.

References

Built on the browser's encodeURIComponent. Unreserved characters and five sub-delimiters (exclamation mark, apostrophe, parentheses, star) pass through unchanged, and everything else is percent-encoded. The page states plainly that it encodes one value and not a whole URL, that a space becomes %20 and not a plus, and that the encoding is reversible and is not encryption.

Popular

Base64 Encoder

Encode any text to standard Base64 in your browser, emoji and accented letters included.

DeveloperOpen Tool
PopularHot

JSON Formatter

Paste messy or minified JSON and get it back pretty-printed with 2-space indentation. The same step tells you whether the JSON is valid.

DeveloperOpen Tool

URL Decoder

Turn percent-encoded text back into readable characters: %20 becomes a space and %26 an ampersand. It uses the browser's decodeURIComponent.

DeveloperOpen Tool
Popular

Hash Generator

Get the MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text at once, updated as you type, with a plain note on which ones are still safe for security work.

DeveloperOpen Tool
Popular

UUID Generator

Generate up to 500 random version 4 UUIDs at once, the 128-bit identifiers used for database keys, from your browser's secure random generator.

DeveloperOpen Tool

Base64 Decoder

Decode Base64 back to readable text in your browser, Unicode included, and get a plain error message when the input is broken.

DeveloperOpen Tool

Back to the URL Encoder

Paste or pick your input at the top of the page. The conversion runs on this device and needs no account.