Base64 encode JSON object
Encode a JSON object as Base64 (for example, to embed in a config file or pass through a header).
Example
Input
{"role":"admin","exp":1735689600}
Base64 output
eyJyb2xlIjoiYWRtaW4iLCJleHAiOjE3MzU2ODk2MDB9
The gotcha
Encoding JSON to Base64 is not encryption. The output is reversible by anyone without any key. Don't use Base64 to "hide" sensitive JSON — it's a transport encoding, not a security primitive. If the data is sensitive, encrypt it (JWE, AES-GCM) before Base64-encoding the ciphertext.
When to use this
Passing a small JSON config through a system that only accepts text — environment variables, HTTP headers, query strings. Embedding a default state in a single-line file. Producing JWT payloads (though most JWT libraries handle this for you).
Open the encoder