XML to Base64 Converter
Encode XML to Base64 as you type
XML Input
Base64 Output
Paste your XML on the left and the Base64 shows up here.
Or drop a file on this box, , or .
What is XML to Base64 Converter?
Some APIs and config fields want an XML document as a single Base64 string: a SAML request, a document field in a JSON payload, a message attribute on a queue. Paste the XML on the left and the Base64 text appears on the right as you type. This page only encodes; to turn Base64 back into XML, use the Base64 Decoder.
The text is converted to UTF-8 bytes first and then encoded with the standard Base64 alphabet from RFC 4648, with = padding. That matters when the XML contains characters such as é or €: the browser's plain btoa() refuses them, and Latin-1 tricks give a different result than the receiving system expects. The XML is not checked or reformatted, so what you paste is exactly what gets encoded.
The sample ends with <note>Café delivery, ring twice</note> on purpose: é is turned into the two UTF-8 bytes C3 A9 before encoding, so the receiving side decodes the same word. All of this is done by TextEncoder and btoa() in the page, without sending the XML to a server.
How to Use XML to Base64
Three steps. The output updates as you type.
Paste, Upload, or Load Sample
Type or paste into the XML Input box, or use Upload, which reads the file as UTF-8 text. Sample loads an order with an accented delivery note. Shortened example:
<order id="ORD-7731" status="paid"><customer>Ava Chen</customer><item sku="SKU-101"><qty>2</qty></item></order> Use Clear to start fresh.
Read the Base64 output
The right panel shows the Base64 text and its length. Base64 is about a third bigger than the input, as the MDN Base64 glossary explains. Whitespace and line breaks in your XML are encoded too.
Download or Copy
Copy places the Base64 string on the clipboard; Download writes it to encoded.txt.
When You'd Actually Use This
API Transmission
Encode XML to Base64 for transmission over text-based APIs. Many APIs require Base64 encoding for binary or XML data. Perfect for REST APIs or webhooks.
Database Storage
Store an XML document in a text column or a key-value store that mangles angle brackets or line breaks. Decode it again when you read it back.
Email Attachments
Encode XML to Base64 for email attachments. Base64 encoding ensures XML data survives email transmission without corruption. Perfect for automated emails.
JSON Embedding
Encode XML to Base64 for embedding in JSON. JSON strings can contain Base64-encoded XML safely. Perfect for hybrid JSON/XML workflows.
Common Questions
Is my XML uploaded?
No. The bytes are produced and encoded on this page, and no request carries the XML anywhere. The cap is 10 MB; for anything bigger, base64 file.xml on the command line is quicker.
What is Base64 encoding?
A way to write any bytes using 64 safe ASCII characters (A-Z, a-z, 0-9, + and /) plus = padding, defined in RFC 4648. It is useful when a channel only carries plain text.
Can this page decode Base64 back to XML?
No, it only encodes. Paste the Base64 into the Base64 Decoder to get the XML back.
How are non-ASCII characters handled?
The XML is encoded as UTF-8, which is what nearly every XML consumer expects. If the receiving system needs a different encoding, convert the text before encoding it.
Does Base64 increase file size?
Yes, by about 33%: every 3 bytes become 4 characters. That is the cost of making the data safe for text-only transport.
Is Base64 secure?
No. It is an encoding, not encryption, and anyone can decode it. Encrypt the data if it needs protecting.
Other XML Tools You Might Need
Once XML is inside a Base64 string, nobody can see a missing closing tag, so format or validate it before you encode. If the receiver wants JSON, YAML or CSV instead, those converters sit here as well: