URL Encoder
Encode text for safe use in URLs online. Paste any string into the live tool below and it is percent-encoded exactly like encodeURIComponent — instantly, privately, in your browser.
About this tool
- What is it?
- DataFormatter URL Encoder is a free online tool that percent-encodes spaces, symbols and Unicode exactly like encodeURIComponent before you put values into links or APIs.
- Who is it for?
- Frontend developers and QA engineers building query strings, form values or hrefs that must be safely URL-encoded.
- What makes DataFormatter's tool different?
- It mirrors the browser's encodeURIComponent behavior and runs entirely locally, so nothing you encode is uploaded.
Manual tool: URL Encode Online — auto-detection is disabled.
Input
0 chars · 0 words · 0 linesPaste or type JSON, Base64, or plain text…
Paste or click a sample above — it will be detected automatically.
Quick start
- Paste the value that belongs inside a link above.
- Auto Detect percent-encodes it instantly.
- Copy the escaped output into your query string or API call.
How URL encoding works
URLs can only carry a limited set of ASCII characters safely. Everything else — spaces, symbols, non-Latin scripts, emoji — must be replaced by percent escapes (%20, %26, …) that describe the UTF-8 bytes of the original character. This process is also known as percent-encoding.
search?q=hello world & moresearch%3Fq%3Dhello%20world%20%26%20moreHow to encode a URL online
- Paste the text or parameter value you want to make URL-safe into the editor above.
- The percent-encoded result appears instantly.
- Copy the encoded string and drop it into your link, query string or API call.
- Going the other way? Switch the toolbar to URL Decode.
Where escaping saves your links
Building search & filter URLs
User-typed terms break query strings the moment they contain & or =. Escape every dynamic value before concatenating it into the link.
Nesting redirect targets
OAuth callbacks and SSO redirects carry a full URL inside another URL. The inner one must be fully percent-encoded or parsers will split it at the wrong places.
UTM tags that analytics can read
Campaign names with spaces or ampersands silently corrupt attribution. Encoded UTM values keep dashboards clean.
Encoding problems explained
My encoded link opens the wrong pageWhy: Double encoding: a value was already escaped once (%26) and got encoded again (%2526), so the server decodes it to literal %26 instead of &.
Fix: Encode once, at the last moment before insertion. If you see %25 sequences, strip one layer first with the URL Decoder.
+ appears instead of %20Why: Form encoding (application/x-www-form-urlencoded) represents spaces as +, while strict percent-encoding uses %20. Mixing conventions confuses some servers.
Fix: Pick one convention per request; this tool always emits %20, which is correct for path segments and most modern APIs.
Non-Latin characters turn into long escape runsWhy: That's expected: each UTF-8 byte becomes its own %XX escape, so emoji or CJK text expands several times over.
Fix: Nothing is wrong — paste the escapes back into the URL Decoder to verify the round trip restores your text.
Pro tips
- After building a gnarly link, run it through the URL Parser to confirm every component landed where you intended.
- Encoding whole payloads instead? Base64 keeps binary-ish data intact where percent-encoding only handles text safely.
- Split view shows original and escaped strings side by side — perfect for spotting accidental double encodes.
- Restore Original undoes experiments instantly if you've edited yourself into a corner.
Percent-encoding glossary
- Percent-encoding
- The URL escaping mechanism defined by RFC 3986: unsafe bytes are written as % followed by two hex digits. Spaces become %20, ampersands %26, and multi-byte Unicode characters become one escape per UTF-8 byte.
Frequently asked questions
Which characters get percent-encoded?
This tool encodes like JavaScript's encodeURIComponent: everything except A–Z, a–z, 0–9, - _ . ! ~ * ' ( ) is replaced with %XX byte escapes — including spaces, &, =, ?, # and slash.
When do I need URL encoding?
Whenever arbitrary text becomes part of a URL — query parameter values, path segments with special characters, or fragments. Unencoded & or = inside a value would otherwise be read as separators.
Is URL encoding the same as Base64?
No. Percent-encoding keeps text readable and only escapes reserved characters; Base64 rewrites all data into a different alphabet and always grows the input by about a third.
What's the difference between encodeURI and encodeURIComponent?
encodeURI preserves full-URL syntax like / ? : @ & = + $ # so a complete link stays navigable; encodeURIComponent escapes those too, which is what you want for individual parameter VALUES. This tool behaves like encodeURIComponent.
Should I encode the whole URL or just its parameters?
Just the values. Encoding an entire URL double-escapes its structure and produces links that no longer work. Encode each dynamic value right before inserting it into the query string.