XML to Base64 Converter
Encode XML to Base64 as you type
XML Input
Base64 Output
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.
How to Use XML to Base64
Three steps. The output updates as you type.
Paste, Upload, or Load Sample
Paste XML into the left panel, or click Upload to load a file. Sample loads a small order. Example:
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. Encoding happens in your browser; your XML never leaves your computer.
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
Encoding is just one XML task. Here are other tools that work well together: