Base64 icon

Base64

Base64 encode and decode a string

Overview

This node performs Base64 encoding and decoding on string data. It is useful when you need to convert data into a Base64 format for safe transmission or storage, or decode Base64-encoded data back into its original string form. Common scenarios include encoding credentials, images, or other binary data as Base64 strings, or decoding Base64 strings received from APIs or files.

For example:

  • Encoding a JSON string into Base64 before sending it in an HTTP request.
  • Decoding a Base64-encoded response payload to retrieve the original content.

Properties

Name Meaning
Action Choose between "Base64 Encode" (convert a string to Base64) or "Base64 Decode" (decode a Base64 string back to text).
Value The input string that will be encoded or decoded.
Output Property Name The name of the property where the resulting encoded or decoded value will be stored.
Options (JSON Parse) When decoding, optionally parse the decoded string as JSON if this option is enabled.

Output

The node outputs the processed data in the json field of each item. The output structure mirrors the input item but adds or overwrites the specified output property with the encoded or decoded string.

If the input item contains binary data, it is preserved in the output without modification.

Example output JSON snippet after decoding with output property name "data":

{
  "data": "decoded string or parsed JSON object"
}

Dependencies

  • Uses Node.js Buffer class for Base64 encoding and decoding.
  • No external API or service dependencies.
  • No special environment variables or credentials required.

Troubleshooting

  • Invalid Base64 string error: If decoding fails due to invalid Base64 input, ensure the input string is correctly Base64 encoded.
  • JSON parse errors: When enabling JSON parsing on decoded data, malformed JSON will cause errors. Disable JSON parsing or validate the input string.
  • Empty input value: Providing an empty string as input will result in an empty output; ensure the input value is set correctly.
  • Output property path issues: Using nested property names (with dots) in the output property name is supported, but ensure the path is valid and does not conflict with existing data structures.

Links and References

Discussion