WebToolsPlanet
Developer Tools

JSON URL Encode

Paste JSON and get a URL-safe encoded string ready to drop into a query parameter or form body. Validates the JSON first and offers minify-before-encode.

Last updated: May 27, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is JSON URL Encode?

Browsers and servers exchange data through URLs and form bodies, but URLs have restrictions on what characters they can contain. Characters like `{`, `"`, and spaces must be percent-encoded for the URL to remain valid. When you want to pass a JSON value through a query parameter — `?data=...` — you need to URL-encode it first.

This tool handles three encoding modes: `encodeURIComponent` (recommended for query values, encodes everything reserved), `encodeURI` (preserves URL-syntax characters like `/` and `?`), and form encoding (uses `+` for space, the standard for `application/x-www-form-urlencoded` POST bodies).

How to Use JSON URL Encode

1

Paste JSON into the input panel.

2

Pick an encoding mode (encodeURIComponent is the safe default for query parameters).

3

Toggle "Minify JSON before encoding" to strip whitespace and reduce URL length.

4

Copy the encoded output.

Common Use Cases

  • Embedding a JSON payload in a query string (?filters=...).
  • Building a form POST body containing a JSON value.
  • Generating links to a debug or playground page that pre-fills a JSON input.
  • Encoding JSON before passing it through a single-page-app URL fragment.

Example Input and Output

A small JSON object is minified and percent-encoded for a query string.

JSON input
{"q":"hello world","page":1}
URL-encoded output
%7B%22q%22%3A%22hello%20world%22%2C%22page%22%3A1%7D

Privacy

All encoding happens in your browser. No JSON is sent to a server.

URL length limits

While there is no strict limit, browsers and servers often cap URLs at around 2,000-8,000 characters. For large JSON payloads, consider POSTing in a request body instead of embedding in the URL.

Frequently Asked Questions

When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent for individual query parameter values — it encodes &, =, ?, /, and other URL-syntax characters that would break the URL. encodeURI preserves those, intended for encoding a complete URL.
What is form encoding?
application/x-www-form-urlencoded — the default for HTML form submissions. It is identical to encodeURIComponent except spaces are encoded as + instead of %20.
Why minify before encoding?
Encoded whitespace adds bytes to the URL. Minifying first removes formatting whitespace, producing a shorter encoded string.
Does this send my JSON anywhere?
No. All encoding happens locally in your browser.