PercentURL / Guides / EncodeURL Online

EncodeURL Online: Browser Tool or Node.js encodeurl?

Use a browser-based encoder for a one-off value. Use Node.js encodeurl when your server needs to encode an already-built URL string. They solve different jobs.

Quick answer: Need to encode text for a link? Open the PercentURL encoder and choose Text / value for one component, or Full URL to preserve a complete link’s structure. In server code, the Node.js encodeurl package handles URL strings while preserving valid percent-encoded sequences; it does not parse or format the URL for you.

For example, encode the single value café & tea as caf%C3%A9%20%26%20tea. Keep the surrounding ?q= structure outside that value. If you are writing Node.js code rather than encoding one item by hand, choose the API for the component you are building.

Choose the encoder for the job

What you needUseWhy
Encode one phrase or parameter value onlinePercentURL Text / value modeIt treats reserved characters in the input as data. For café & tea, the result is caf%C3%A9%20%26%20tea.
Build a query string in browser or Node.js codeURLSearchParamsIt serializes name/value pairs as form-style query data; spaces may appear as +, while a literal plus is encoded as %2B.
Encode a composed URL string for server outputNode.js encodeurlIt encodes non-URL code points as UTF-8 and preserves valid percent sequences such as %20. It does not parse or format URL components.
Encode one dynamic JavaScript valueencodeURIComponent(value)It encodes component data. Do not run it over a whole URL whose separators must remain structural.

What the Node.js encodeurl package does

The package maintained by PillarJS accepts a URL string and converts non-URL code points to UTF-8 percent-encoded bytes. A valid existing escape such as %20 is left intact; an invalid percent sequence such as %foo is encoded as data. The package is similar to JavaScript’s encodeURI, but it does not parse or format the URL.

That distinction matters for query values. If the text red & blue belongs inside one parameter, a URL-level encoder may leave & as URL syntax. Use URLSearchParams or encode that single value with encodeURIComponent so the ampersand stays data.

const encodeUrl = require('encodeurl');

// Build and validate the URL structure first.
const rawLocation = buildRedirectLocation(request);
response.setHeader('Location', encodeUrl(rawLocation));

The application still owns URL construction and validation. Encoding does not encrypt data, approve a redirect destination, or replace checks required by your framework.

When to use PercentURL online

  1. Identify whether the input is one value or a complete URL.
  2. For one value, use Text / value; for a structured link, use Full URL.
  3. Encode once, then inspect the finished URL in context.
  4. For query strings created in code, prefer the platform’s URL builder rather than concatenating raw separators.

The browser tool is useful for a one-off conversion; the Node.js package belongs in a server workflow. Neither is a substitute for the other when the input context differs.

Try the online encoder

Encode one value or inspect a complete URL in your browser. The tool runs locally in the page.

Open PercentURL Encoder / Decoder

For JavaScript APIs, see URL encoding in JavaScript. For the general browser workflow, read URL Encoder Online.

Sources