XML to Base64

Validate XML, then encode it as UTF-8 Base64.

Local Your input is processed locally in your browser. Found a problem? Report an issue

What XML to Base64 does

Validate XML, then encode it as UTF-8 Base64. Text is handled as UTF-8, so accented letters, other scripts and emoji survive the round trip.

XML to Base64 examples

The built-in sample

Input

<users><user id="1"><name>Ada</name></user><user id="2"><name>Lin</name></user></users>

Output

PHVzZXJzPjx1c2VyIGlkPSIxIj48bmFtZT5BZGE8L25hbWU+PC91c2VyPjx1c2VyIGlkPSIyIj48bmFtZT5MaW48L25hbWU+PC91c2VyPjwvdXNlcnM+

This is the input that the Load sample button fills in.

Surrounding whitespace is trimmed

Input

 <a>é</a> 

Output

PGE+w6k8L2E+

The spaces before and after the document are not encoded.

Each output was produced by running this tool on the input above it.

How it works

The input is first checked as XML; invalid input is reported instead of being encoded. The text is then converted to UTF-8 bytes and encoded with the standard Base64 alphabet (RFC 4648), padded with = to a multiple of four characters.

Details and limits

  • Encoding and decoding are exact, so the data comes back without losing anything.
  • The bytes are UTF-8. If the XML declaration names another encoding, such as encoding="ISO-8859-1", the declaration no longer matches the encoded bytes.
  • The standard alphabet with padding is used, as in the other Base64 encoders here.
  • Input that is not valid XML stops the tool, and the status line shows where the problem is. The XML Validator page lists the usual causes.

Questions

Is my data uploaded when I use XML to Base64?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does XML to Base64 do?

Validate XML, then encode it as UTF-8 Base64. Text is handled as UTF-8, so accented letters, other scripts and emoji survive the round trip.

How does XML to Base64 work?

The input is first checked as XML; invalid input is reported instead of being encoded. The text is then converted to UTF-8 bytes and encoded with the standard Base64 alphabet (RFC 4648), padded with = to a multiple of four characters.

Are there any limits I should know about?

The bytes are UTF-8. If the XML declaration names another encoding, such as encoding="ISO-8859-1", the declaration no longer matches the encoded bytes. The standard alphabet with padding is used, as in the other Base64 encoders here.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.