JSON URL Encoder
URL-encode JSON strings for safe use in query parameters and links
JSON Input
URL-Encoded Output
Paste your JSON on the left and the result shows up here.
Or drop a file on this box, , or .
What Is JSON URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in a URL into a safe %XX hexadecimal sequence. When you need to embed a JSON string inside a URL, for example as a query parameter, characters like {, }, ", spaces, and brackets must be encoded or the URL will break.
This tool applies JavaScript's encodeURIComponent() to exactly what you typed, whitespace and line breaks included. The RFC 3986 URI standard specifies which characters are safe in a URL and which must be percent-encoded. Tip: minify the JSON first (no newlines, no indentation) and the encoded result gets much shorter. The reverse operation is handled by the JSON URL Decoder.
How to URL-Encode JSON
Follow these steps to percent-encode your JSON string.
Paste or enter your JSON
Put the JSON you want to carry in a URL into the left box. Sample drops in a one-line order filter with a status, a customer name and two SKUs. A fragment that is not valid JSON still gets encoded, with a yellow note above the output, which helps when you only need part of a value escaped. To check syntax before it goes into a link, see the MDN JSON reference and the RFC 8259 grammar are good references.
Encoding
The encoded output appears automatically in the right panel. Every unsafe character is replaced with its %XX equivalent, for example { becomes %7B and " becomes %22.
Copy the result
Click Copy to copy the URL-encoded string to your clipboard. You can then paste it directly into a URL query parameter, a fetch call, or any HTTP request.
Common Use Cases
Query Parameter Embedding
Many REST APIs accept JSON objects as query parameters (e.g., ?filter={"status":"active"}). URL encoding ensures the JSON is transmitted correctly without corrupting the URL structure.
Shareable State Links
Single-page applications often encode UI state as JSON in the URL so users can share links that restore the exact view. URL encoding makes this JSON safe for browsers and routers.
HTTP GET Requests with JSON Bodies
Some APIs use GET requests with JSON in the query string instead of a request body. URL-encoding the JSON payload ensures it survives proxy servers, CDNs, and browser URL length limits.
Debugging and Logging
When logging API requests or building debugging tools, you often need to embed raw JSON in a URL-safe format. URL encoding lets you include full JSON payloads in log lines and dashboard URLs.
Frequently Asked Questions
How do encodeURIComponent and encodeURI differ?
Run {"q":"a&b"} through both and you see it. encodeURIComponent gives %7B%22q%22%3A%22a%26b%22%7D, while encodeURI gives %7B%22q%22:%22a&b%22%7D and leaves the ampersand bare, because in a full URL & starts the next parameter. A JSON value sitting after ?filter= must never be able to do that, so this page uses the component version. Only letters, digits and - _ . ! ~ * ' ( ) come through unchanged.
Does my JSON need to be valid before encoding?
No. Any text gets encoded, and a note above the output tells you when it isn't valid JSON. If you plan to decode it as JSON later, fix the syntax first so the round trip gives you something a parser accepts.
Will spaces be encoded as + or %20?
encodeURIComponent encodes spaces as %20, not +. The + encoding is used by the older application/x-www-form-urlencoded format. When passing JSON in a URL query string, %20 is the correct and unambiguous representation.
Is my data sent to a server?
No. Each time the box changes, the page calls the browser's own encodeURIComponent on its text, and there is no request behind it. The one input it refuses is an emoji that got split in two while copying (a lone UTF-16 surrogate), because that function throws on it. You get a short message in the output instead.
How do I decode the result back to JSON?
Use the JSON URL Decoder tool, or call decodeURIComponent(encodedString) in your JavaScript code.
Related Tools
Explore more JSON and URL utilities on jsonparser.ai.