Code Beautifier

Base64 Encode & Decode

Encode plain text to Base64 or decode Base64 strings to UTF-8 text with URL-safe encoding and automatic JSON formatting. · Updated

Options
Action:
text
Formatted Outputtext
Draft saved locally.

Base64 shows up in JWTs, data URLs, and protocol buffers. Encode and decode locally with UTF-8-safe handling so secrets never cross the network.

Common errors and fixes

Invalid Base64 character

Remove whitespace or URL-encoding artifacts, or switch to URL-safe mode if your alphabet uses - and _.

Why it happens, with a live example

Incorrect padding

Base64 length should be a multiple of 4. Add = padding or enable automatic padding repair if available.

Why it happens, with a live example

Decoded text is garbled

The payload may be binary. Try viewing as a data URL via the Base64 Image converter.

URI malformed

When decoding to UTF-8 text, ensure the bytes form valid Unicode.

Why it happens, with a live example

Options

OptionDescription
ActionSelect whether to decode an existing Base64 payload or encode plain text into Base64 format.
URL-safe format (- and _)Replaces standard + and / characters with URL-safe - and _ characters without padding.
Auto-format decoded JSONIf the decoded result is valid JSON, it will be automatically formatted and beautified.

FAQ

Does this Base64 tool support UTF-8 and Unicode characters (e.g. emojis)?

Yes. All strings are converted using standard UTF-8 binary buffers, correctly handling international characters and emojis.

What is URL-safe Base64?

URL-safe Base64 replaces the standard '+' and '/' characters with '-' and '_' to prevent URL query string collision.

Can this tool format decoded JSON payloads?

Yes. If the decoded payload is valid JSON and 'Auto-format decoded JSON' is checked, it will be beautified automatically.

How do I encode a string to Base64?

Switch the Action option to 'Encode (Text → Base64)' and paste your plain text into the input pane.