What JSON to Base64 does
Validate JSON, then encode it as UTF-8 Base64. Text is handled as UTF-8, so accented letters, other scripts and emoji survive the round trip.
JSON to Base64 examples
The built-in sample
Input
{"name":"Ada Lovelace","active":true,"tags":["math","code"],"address":{"city":"London"}}Output
eyJuYW1lIjoiQWRhIExvdmVsYWNlIiwiYWN0aXZlIjp0cnVlLCJ0YWdzIjpbIm1hdGgiLCJjb2RlIl0sImFkZHJlc3MiOnsiY2l0eSI6IkxvbmRvbiJ9fQ==This is the input that the Load sample button fills in.
The text is encoded exactly as typed
Input
{ "name": "Zoë" }Output
eyAibmFtZSI6ICJab8OrIiB9The JSON is checked but not minified: the spaces are part of the encoded bytes. ë takes two bytes in UTF-8.
Each output was produced by running this tool on the input above it.
How it works
The input is first checked as JSON; 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.
- Base64 output is about one third longer than the input: every three bytes become four characters.
- The standard alphabet with
+,/and=padding is used. For a URL or a JWT, replace+with-,/with_and drop the padding. - To encode a compact form, run JSON Minify first.
- Input that is not valid JSON stops the tool, and the status line shows where the problem is. The JSON Validator page lists the usual causes.
Questions
Is my data uploaded when I use JSON 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 JSON to Base64 do?
Validate JSON, 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 JSON to Base64 work?
The input is first checked as JSON; 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?
Base64 output is about one third longer than the input: every three bytes become four characters. The standard alphabet with +, / and = padding is used. For a URL or a JWT, replace + with -, / with _ and drop the padding.
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.