JSON Converters Code Gen Formatters All tools Browse all tools built byAbhay Darji

XML URL Encoder

Percent-encode XML so it can be passed safely in a URL or query string.

100% client side No upload No size limit Works offline
Input
Output
Ready
Drop a file to load it

About this tool

Percent-encode an XML document so every reserved character survives being placed in a URL.

When you would use it

  • Passing XML as a query parameter
  • Building a deep link that carries data
  • Encoding a value for a redirect

Worked example

XML
<?xml version="1.0" encoding="UTF-8"?>
<user id="4815">
  <name>Ada Lovelace</name>
  <active>true</active>
  <score>91.5</score>
  <roles>
    <role>admin</role>
    <role>editor</role>
  </roles>
</user>
Encoded
%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Cuser%20id%3D%224815%22%3E%0A%20%20%3Cname%3EAda%20Lovelace%3C%2Fname%3E%0A%20%20%3Cactive%3Etrue%3C%2Factive%3E%0A%20%20%3Cscore%3E91.5%3C%2Fscore%3E%0A%20%20%3Croles%3E%0A%20%20%20%20%3Crole%3Eadmin%3C%2Frole%3E%0A%20%20%20%20%3Crole%3Eeditor%3C%2Frole%3E%0A%20%20%3C%2Froles%3E%0A%3C%2Fuser%3E

Things worth knowing

  • Component mode escapes the reserved characters &, =, ?, / and #, which is what you need inside a query value.
  • Long documents make for unwieldy URLs — most servers and browsers stop somewhere around 2,000 to 8,000 characters. Base64 in a request body is usually the better choice.
Questions

Frequently asked

What is the difference between the encoding modes?
Component mode escapes reserved characters and is right for a single query value. URI mode leaves /, ? and # intact so a whole URL stays usable. Form mode encodes spaces as + for application/x-www-form-urlencoded bodies.
Is my data uploaded anywhere?
No. Every tool on JSONWorks runs entirely in your browser using JavaScript. Your input is never sent to a server, never logged and never stored. The simplest proof is to disconnect from the internet — the tools keep working. The site does load Google Fonts and a Google Analytics page-view tag, so you will see those two requests in your network tab, but neither receives anything you type or paste.
Related

Tools that pair well with this