Encoding & Conversion

URL Encoder & Decoder

A parameter such as a search phrase can contain spaces, ampersands and other characters that have special meaning in a URL. Encode the value before inserting it into a query or route segment. This page uses the browser’s component encoder, so it also escapes colons and slashes. Decode once when examining a value that was encoded once: repeated decoding can change data unexpectedly. The tool does not fetch the URL, follow a link or check whether a destination exists.

Your workspace

Runs locally in your browser

Result

Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.

How to use this tool

Paste a parameter value and choose Encode. Use Decode for an already percent-encoded component.

Example

Input

hello world & tea

Output

hello%20world%20%26%20tea

What does this tool do?

Percent encoding represents characters as escaped bytes inside a URL component. It keeps delimiters in a parameter value from being interpreted as URL syntax.

Common mistakes and limitations

This tool uses encodeURIComponent, not whole-URL encoding. Plus signs are preserved during decoding; form-encoded spaces require separate handling.

Encode a value, not an assembled URL

Percent encoding represents bytes using a percent sign followed by hexadecimal digits. Characters such as &, =, ? and # have structural roles in a URL. If a search value contains an ampersand, encoding the value prevents it from being mistaken for the start of another query parameter. This tool follows encodeURIComponent behavior: it is intended for a component such as a parameter value, rather than preserving separators in a complete URL as encodeURI conceptually does.

Value: tea & coffee
Encoded: tea%20%26%20coffee
Query: ?q=tea%20%26%20coffee

Spaces, plus signs and repeated encoding

A space is encoded here as %20. Form-style query serialization often uses + for a space, but a literal + is not automatically converted to a space by this decoder. If you need application/x-www-form-urlencoded semantics, use a form/query parser in your application. Encoding already encoded text again turns % into %25. Decode only the number of layers you actually expect; repeated decoding can change the meaning of data.

Why decoding can fail

A lone percent sign or an incomplete escape such as %2 is malformed. Percent bytes that do not form valid UTF-8 can also cause an error. Keep the original value and check its source encoding instead of deleting escapes until something appears readable. Encoding is a syntax operation, not encryption or validation of a destination. A decoded link can still point to an untrusted website, and an encoded string is not automatically safe in HTML or a shell command.

Build query parameters predictably

For a full application URL, construct query parameters with a URL API rather than concatenating partially encoded fragments. Decide which layer owns encoding so a framework does not encode the same value twice. Test values containing spaces, Unicode, plus signs and ampersands. A working example with only letters can hide a separator bug that appears only when users search for a phrase or paste an email address.

Frequently asked questions

Should I encode an entire URL?

Usually no. Encode individual parameter values; encoding the whole URL also escapes its separators.

Related tools