Skip to content

URL Encoder

Developer Tools ·
·

Encode text for safe use in URLs using percent-encoding

Make your text URL-safe

URLs have rules. Characters like &, =, ?, /, and # are structural, they mean things. A & separates query parameters. A ? starts the query string. If your data contains those characters and you stuff them into a URL raw, things break in confusing ways.

Percent-encoding fixes this. A space becomes %20. An ampersand becomes %26. A question mark becomes %3F. The browser knows these are literal characters, not URL syntax.

This tool uses encodeURIComponent, the correct function for encoding URL parameter values. It encodes everything except unreserved characters (A-Z, a-z, 0-9, - _ . ! ~ * ' ( )), and it handles Unicode properly.

The common encodings

Space → %20 &%26 =%3D ?%3F /%2F #%23 @%40 +%2B %%25

When you need this

Building query strings. If your search term is “mac & cheese,” the URL needs ?q=mac%20%26%20cheese, not ?q=mac & cheese (which would break the & into a parameter separator).

OAuth redirect URLs. You’re passing a callback URL as a parameter to another URL. The inner URL has to be fully encoded or the outer parser will choke on its slashes and question marks.

API requests. Anything user-provided that goes into a URL path or query string needs encoding. File names with spaces, search queries with special characters, filter values with slashes.

Form data. Browser forms use URL encoding by default for POST data (application/x-www-form-urlencoded).

encodeURI vs encodeURIComponent

JavaScript has two encoding functions and picking the wrong one is a classic bug.

encodeURIComponent (what this tool uses) encodes all special characters. Use it when encoding a parameter value.

encodeURI leaves structural characters like :, /, ?, & alone. Use it when encoding a complete URL where you want the structure preserved.

For most tasks, encoding query values, form data, API parameters, encodeURIComponent is the right choice.

To decode percent-encoded URLs back to readable text, use the URL Decoder.

FAQ

Should I encode the whole URL or just the values?

Just the parameter values, typically. Encoding the entire URL would break the structural delimiters.

Unicode support?

Yes, international characters and emojis are converted to their UTF-8 percent-encoded representation. The euro sign becomes %E2%82%AC.

%20 vs + for spaces?

This tool uses %20, which is universally correct for URL encoding. The + convention is specific to application/x-www-form-urlencoded (HTML form POST data).

Client-side?

Yes, your text stays in your browser.

url encoder percent-encoding query-string web

Related Tools

More in Developer Tools

CSS Flexbox Playground

Play with flex-direction, justify-content, align-items, wrap, and gap. Add or drop items, watch the layout shift live, then copy the container CSS.

CSS Formatter

Format and beautify CSS code with proper indentation

CSS Glassmorphism Generator

Build frosted-glass UI elements with backdrop-filter blur and saturation, live preview against a colorful gradient.

CSS Grid Generator

Build a CSS grid visually. Set columns, rows, gaps, and fr/px/auto track sizes, watch the cells update live, then copy the grid CSS.

CSS Minifier

Minify CSS by removing comments, whitespace, and unnecessary characters

CSS Loader Generator

Build a pure-CSS loading spinner with no JavaScript or images. Pick a style, set the size, color, and speed, preview it live, and copy the CSS plus keyframes.

CSS Specificity Calculator

Paste a CSS selector and get its specificity as (a,b,c) with a full breakdown of which IDs, classes, and elements scored where.

CSS Text Shadow Generator

Build CSS text-shadow visually with sliders for offset, blur, color, and opacity, six presets covering subtle, classic, glow, retro, neon, emboss.

CSS to Tailwind Converter

Paste plain CSS and get equivalent Tailwind utility classes back. Common properties map to named classes; anything else falls back to arbitrary values.

CSS Triangle Generator

Build a pure-CSS triangle with the border trick. Pick a direction, set the size and color, and copy the ready-to-use code. Eight directions supported.

CSS Unit Converter

Convert a CSS length between px, rem, em, pt, %, vw and vh at once. Set your base and parent font-size plus viewport, see every unit live.

Cubic Bezier Generator

Drag two control points to shape a CSS easing curve, watch it animate live, and copy the cubic-bezier() value. Six presets including overshoot.

View all 81Developer Tools