XML to Base64
Convert any XML document into a Base64-encoded string, safely handling Unicode characters via UTF-8.
Example
Encode a small XML snippet:
Input: <note><to>World</to></note>
Output: PG5vdGU+PHRvPldvcmxkPC90bz48L25vdGU+
Unicode is preserved via UTF-8:
Input: <t>友</t>
Output: PHQ+5Y+JPC90Pg==
How it works
Paste XML in the input pane; it is encoded to UTF-8 bytes and then Base64 live as you type. Click Copy to grab the result or Clear to reset.
Good to know
XML to Base64 turns any XML markup you paste into a single Base64 string, encoding the text as UTF-8 bytes first so that accented letters, emoji, and CJK characters survive the round trip. It is aimed at developers who need to embed or transport XML where raw angle brackets, quotes, and newlines would otherwise break the surrounding format — for example stuffing a SOAP payload into a JSON field, a SAML assertion into a URL parameter, or an XML config into an environment variable.
Reach for it whenever a system expects opaque ASCII rather than structured markup: encoding XML into a data URI, a YAML or .env value, an HTTP header, a database column that mangles special characters, or a message queue body. Because everything happens in your browser, it is also a safe choice for sensitive documents like signed XML or API credentials that you would not want to paste into a server-side converter.
The result is straightforward to read: the output pane holds the Base64 text, and the status line tells you how many input characters became how many Base64 characters. Expect the encoded length to grow — Base64 adds roughly one third of overhead, and multibyte UTF-8 characters expand further because one visible character can be several bytes before encoding. Trailing = signs are normal padding, not an error.
A practical caveat: this is standard Base64, not the URL-safe variant, so the output can contain +, /, and = that must be percent-encoded before use in a query string or filename. Also note the tool encodes your XML exactly as typed, including indentation and any XML declaration — if you need a canonical or whitespace-normalized form, clean the markup up before encoding, since Base64 will faithfully preserve every byte.
Frequently asked questions
Does this handle non-ASCII XML like accented or CJK characters?
Yes. The text is first encoded to UTF-8 bytes with TextEncoder, then Base64-encoded, so characters like ä, ö, ü or 友 are preserved correctly on decode.
Is my XML uploaded anywhere?
No. Encoding runs entirely in your browser using TextEncoder and btoa. Nothing is sent over the network, so it is safe for sensitive documents.
Is my data uploaded anywhere?
No — this tool runs entirely in your browser. Your input never leaves your device and it works offline once loaded.
Is it free?
Yes, completely free with no sign-up and no limits.
People also ask
How do I decode an XML Base64 string back to XML?
Use any Base64-to-text decoder that interprets the bytes as UTF-8, such as a browser's atob combined with TextDecoder, or a base64-to-XML tool. Decoding reverses this exact process and restores the original markup, including special characters.
Is Base64-encoded XML still valid XML?
No. Base64 output is an opaque ASCII string, not parseable XML. You must decode it back to its original bytes before an XML parser can read it.
Why is my Base64 output longer than the XML I pasted?
Base64 represents every 3 bytes as 4 characters, adding about 33% overhead, and non-ASCII characters become multiple UTF-8 bytes before encoding. So Unicode-heavy XML can grow noticeably.
What do the equals signs at the end of the Base64 mean?
They are padding characters that make the output length a multiple of four. One or two equals signs are normal and indicate how many bytes were in the final group; they are part of standard Base64.
Can I use this Base64 directly in a URL?
Not always safely. Standard Base64 can include +, /, and = characters, which have special meaning in URLs and should be percent-encoded or converted to a URL-safe Base64 alphabet first.
Does encoding XML to Base64 encrypt or secure it?
No. Base64 is reversible encoding, not encryption, and anyone can decode it instantly. It only changes the representation of the data, not its confidentiality.
Why convert XML to Base64 instead of just escaping it?
Base64 produces a compact, single-line, transport-safe string that avoids any character collisions with the host format, whereas escaping can be fragile across different contexts like JSON, URLs, and headers.
Can I encode an entire XML file with this tool?
You can paste the file's contents into the input pane and it will encode the text. It works on XML as text rather than as a file upload, so very large files are limited mainly by browser memory.
Related tools