JSON URL Encode

Encode JSON for a URL query parameter — percent-encoding or URL-safe Base64 — with a warning when the result is too long for a URL.

What It Does

This tool prepares a JSON document for a URL. It minifies the JSON, then either percent-encodes it with encodeURIComponent — so characters like &, = and # cannot end the parameter early — or converts it to URL-safe Base64, which is shorter for most payloads and contains only letters, digits, - and _. The notes show the size before and after, and warn when the result passes the length at which servers and proxies start rejecting URLs.

When to Use It

  • You are building a link that carries filter state or a small config as a query parameter.
  • A redirect or OAuth state parameter needs to carry structured data.
  • You are testing an API that accepts a JSON-encoded filter in the query string.
  • You want to compare percent-encoding with Base64 to pick the shorter for your payload.

Worked Examples

{"q":"cats & dogs","page":2}

Percent-encoded as %7B%22q%22%3A%22cats%20%26%20dogs%22%2C%22page%22%3A2%7D — the & is encoded, so it cannot split the parameter.

{"filters":{"status":["open","pending"],"owner":"me"}}

Tick URL-safe Base64 and compare the length — for quote-heavy JSON, Base64 is usually shorter than percent-encoding.

%7B%22a%22%3A1%7D

The reverse direction decodes a value back to formatted JSON.

Features

Runs as you type
Clear error messages with line and column
Explains what changed and why
One-click copy
Works offline
Nothing uploaded

How to Use

1. Paste your input into the top box. 2. Adjust the options if the page has any — the result updates as you type. 3. Read the notes under the result, then copy it.

Common Mistakes

  • Editing the result by hand and breaking the escaping. If you need to change the content, change the input and run it again — a single stray backslash makes the whole value invalid.
  • Assuming the browser preserved Windows line endings. A pasted CRLF becomes LF in any text box, so a byte-exact comparison with the original file can still differ.
  • Trusting that two documents are equal because they look equal. Key order, whitespace and number formatting differ between serializers; compare parsed values, not text.

Frequently Asked Questions

Everything runs in your browser. Your JSON is never uploaded, logged or stored.

Explore related topics

#JSON