portfolios.tools

Base64 Text Encoder and Decoder

Encode Unicode text as standard Base64 or decode Base64 bytes to valid UTF 8 text. Review the selected mode and raw output.

Input
Mode
Selected direction: Encode
Result

How it works

Enter text and choose encode, decode, or auto. Encode converts well formed Unicode text to UTF 8 bytes, then writes those bytes with the standard Base64 alphabet and padding.

Decode accepts standard Base64 with or without trailing padding, provided unused trailing bits are zero. It returns text only when decoded bytes are valid UTF 8. Whitespace, URL safe characters, malformed padding, and nonzero trailing bits are rejected.

Auto selects decode for nonempty input that matches canonical standard Base64 syntax. Otherwise it selects encode. If the selected decode input is not valid UTF 8, the tool reports an error and does not fall back to encoding.

When decoded text is valid JSON, a separate formatted view is shown. The raw output remains visible, and Copy copies the raw output. JSON formatting can change numeric values and collapses duplicate object keys.

Step by step

  1. Enter text or a Base64 string
  2. Choose a mode and check the selected direction
  3. Review or copy the raw output

Worked example

In encode mode, enter the single character é. The tested UTF 8 result is w6k=.

In decode mode, enter w6k=. The raw output is é. Both directions use the standard Base64 alphabet.

When to use this tool

Use the tool to inspect or create a Base64 representation of text when an API or text format requires it.

Choose a direction explicitly when the input is ambiguous, and use a binary capable tool for data that is not UTF 8 text.

Common mistakes

If the selected direction is not the one you intended, choose encode or decode explicitly. Auto detection cannot know whether valid Base64 looking text was meant as ordinary text.

Do not use the formatted JSON view as an exact copy of the source. Copy the raw output when preserving its original decoded text matters.

Encoding and decoding rules

Encode: UTF 8 bytes = TextEncoder(text); Base64 = standard padded encoding of those bytes

Decode: bytes = standard Base64 decode(text); output = fatal UTF 8 decode(bytes)

Auto: canonical standard Base64 syntax selects decode; other nonempty text selects encode

The decoder accepts standard Base64 in padded or unpadded form when unused trailing bits are zero. It rejects whitespace, URL safe alphabet characters, and malformed padding. Input limit: 100,000 UTF 16 code units.

Assumptions and limits

This tool converts text using UTF 8 and the standard Base64 alphabet. It is not a binary file viewer. Auto detection is a syntax heuristic, so ordinary text that matches valid Base64 may be decoded. URL safe Base64 used in some token formats is not accepted. The input limit is 100,000 UTF 16 code units. JSON formatting is a separate parsed view that can change numeric values and collapses duplicate keys; the raw decoded output is retained for viewing and copying.

Key terms

Base64
A text representation of bytes using the standard Base64 character alphabet.
UTF 8
The character encoding used to convert text into bytes before Base64 encoding and after decoding.
Canonical Base64
A padded Base64 representation with zero unused trailing bits, giving a unique encoding for its bytes. This decoder also accepts the same bytes without trailing padding.

Related tools

Use the JWT Debugger for URL safe Base64 segments in tokens. This tool accepts the standard Base64 alphabet for UTF 8 text.

Choose encode, decode, or auto detection. Review the limits before using the result in another application.

FAQ

What does Base64 do to text?

Base64 represents bytes with text characters. In this tool, encode mode first converts well formed text to UTF 8 bytes, then encodes those bytes. Decode mode reverses the steps and requires valid UTF 8 text.

Does Base64 encrypt or protect a message?

No. Base64 changes representation, not confidentiality or integrity. Anyone can decode the text, and Base64 does not detect whether data was altered.

Which Base64 strings can this decoder read?

The decoder accepts the standard alphabet A to Z, a to z, 0 to 9, plus, and slash. In padded or unpadded form, unused trailing bits must be zero so the bytes have a unique encoding. It rejects whitespace, URL safe characters, and misplaced padding.

How does auto mode choose a direction?

Auto mode decodes nonempty input that matches canonical standard Base64 syntax. Otherwise it encodes the text. If matching Base64 bytes are not valid UTF 8, it shows a decode error instead of switching to encode. Plain text can look like Base64, so check the selected mode.

Does JSON formatting change the copied output?

The raw decoded text remains visible and the copy button copies that raw value. A separate formatted view appears for valid JSON. Parsing and serializing can change numeric values, including large numbers, and collapses duplicate object keys in the formatted view.

Related tools

The JWT Debugger handles URL safe Base64 segments used by JWTs. This calculator uses the standard alphabet and UTF 8 text decoding.