Validate JSON, optionally minify, and encode it as Base64 (standard or URL-safe).
JSON to Base64 encodes a JSON document as Base64 text, and decodes Base64 back into JSON. It validates the JSON first, lets you minify or pretty-print it, and can produce the URL-safe alphabet. It is useful for putting a JSON payload into a URL, header, environment variable or token-like string.
JSON is text, and Base64 is a way to write bytes using only 64 safe printable characters. To encode JSON, the text is first converted to UTF-8 bytes and those bytes are then written in Base64. The result contains no quotes, braces or spaces, so it survives places that mangle them, such as query strings, HTTP headers or shell variables. The standard alphabet uses plus, slash and equals padding. The URL-safe alphabet from RFC 4648 uses hyphen and underscore and omits padding, which is what JWT segments use. Base64 is an encoding, not encryption: anyone can reverse it, so it should not be used to hide secrets. Because the bytes come from the parsed and re-serialised JSON, whitespace follows the chosen format, not necessarily your original text.
No. It is a reversible encoding with no key, so anyone can decode it. Do not use it to protect secrets.
A variant from RFC 4648 that replaces + and / with - and _ and normally drops the = padding so the string can sit in a URL without escaping.
Encoders can differ in whitespace, pretty-printing and padding. Here the JSON is parsed and re-serialised, so spacing follows the Minify or Pretty choice.
Yes. The JSON text is converted to UTF-8 before encoding, and decoding reads UTF-8 back.
No. Encoding and decoding happen in the page and the input is not sent to a server.