Output will appear here
Output will appear here
Paste JSON and get its Base64 encoding: the text is encoded as UTF-8, then written in the standard RFC 4648 alphabet with = padding. Paste a Base64 or base64url string instead and it is decoded and pretty-printed as JSON. The direction is picked from the input: anything that parses as JSON is encoded. Whitespace inside the JSON is encoded too, so minify first for the shortest string.
By Ankit Aglawe · Updated · Runs entirely in your browser
Minified JSON gives the shortest result. This string can go in the data field of a Kubernetes Secret or an environment variable that only accepts ASCII.
{"username":"admin","password":"s3cr3t-Pa55"}eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJzM2NyM3QtUGE1NSJ9The line breaks and spaces are encoded as well, so this output is longer than the Base64 of the same object minified. Run it through the JSON Minifier first if size matters.
{
"event": "invoice.paid",
"amount": 4900
}ewogICJldmVudCI6ICJpbnZvaWNlLnBhaWQiLAogICJhbW91bnQiOiA0OTAwCn0=This is base64url without padding, the form JWT segments and many webhook headers use. It is not JSON, so the tool decodes it, restores the padding and pretty-prints the result, including the UTF-8 é.
eyJ1c2VyIjoiSm9zw6kiLCJyb2xlcyI6WyJhZG1pbiJdfQ{
"user": "José",
"roles": [
"admin"
]
}Text is encoded as UTF-8 before Base64, so José 🚀 becomes Sm9zw6kg8J+agA==, the same bytes Node's Buffer.from(s).toString("base64") or Python's base64.b64encode(s.encode()) would give. Calling btoa directly on that string throws, because btoa only accepts Latin-1.
Encoding uses the standard alphabet, which can contain + and /. For URLs, JWT segments or filenames you need base64url: replace + with -, / with _, and usually drop the trailing =. Decoding accepts both alphabets, with or without padding.
Base64 encodes 3 bytes as 4 characters. When the input length is not a multiple of 3, the output ends in = or ==. Most decoders require it; base64url decoders usually accept it missing.
Two JSON documents that parse to the same value can encode to different strings if their spacing differs. If you compare or sign Base64 payloads, minify or canonicalize the JSON first.
Base64 output is about 4/3 the size of the input, rounded up to a multiple of 4 characters.
If the decoded bytes are not JSON, the plain text is shown instead. If they are not valid UTF-8 (an image or other binary data), you get an error rather than garbled characters. For a JWT, use the JWT Decoder, which splits the three segments first.
| Variant | Alphabet ends with | Padding | Used in |
|---|---|---|---|
| Standard (encoder output) | + / | = always | Kubernetes Secrets, email (MIME), data URIs |
| base64url (decoder accepts) | - _ | Usually omitted | JWT, URL query params, filenames |
To encode: paste a JSON object. To decode: paste a Base64-encoded string. The tool auto-detects the direction based on your input.
Encoding produces a Base64 string from your JSON. Decoding produces formatted JSON from a Base64 string. Both directions work instantly.
Click Copy to grab the Base64 string or decoded JSON for embedding in APIs, webhooks, environment variables, or data transfer payloads.
Paste the JSON in the left pane. If it parses, the Base64 string appears on the right, ready to copy.
Yes. Text is encoded as UTF-8 first, which is what every server-side Base64 library expects, and decoded the same way.
Paste the Base64 string in the left pane. Because it is not JSON, the tool decodes it instead of encoding it, and pretty-prints the result if it is JSON. base64url strings without padding work too.
No, it is standard Base64. Replace + with -, / with _ and strip the = padding to get base64url.
Spaces and line breaks are encoded too. Minified JSON gives a shorter string and the same string every time for the same data.
No. Anyone can decode it. Do not use it to hide secrets; Kubernetes Secrets, for example, are only Base64-encoded, not encrypted.
Need several formats at once? Convert All shows every output from one paste. Or browse all JSON converters.