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 strings back to their original form. Common scenarios include encoding binary data as text for APIs that require Base64 input, or decoding Base64 responses from web services.

For example:

  • Encoding an image or file content into Base64 before sending it in an HTTP request.
  • Decoding a Base64-encoded JSON string received from an external system to use it as structured data within a workflow.

Properties

Name Meaning
Action Choose between "Base64 Encode" (convert a string to Base64) or "Base64 Decode" (decode a Base64 string).
Value The string value to 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 set to true.

Output

The node outputs the transformed data in the specified output property inside the json object of each item. For example, if the output property name is "data", the output will look like:

{
  "data": "base64EncodedStringOrDecodedValue"
}

If the "JSON Parse" option is enabled during decoding, the output will be a parsed JSON object instead of a plain string.

The node preserves any existing binary data attached to the input items without modification.

Dependencies

  • No external API or service dependencies are required.
  • Uses Node.js Buffer class for Base64 transformations.
  • Requires no special environment variables or credentials.

Troubleshooting

  • Invalid Base64 input: If decoding fails due to invalid Base64 input, an error will be thrown. Ensure the input string is properly Base64 encoded.
  • JSON parse errors: When using the JSON Parse option, malformed JSON after decoding will cause parsing errors. Verify the decoded string is valid JSON.
  • Empty input values: Providing empty strings as input may result in empty output; ensure the input value is correctly set.
  • To continue processing other items even if one fails, enable the node's "Continue On Fail" option.

Links and References

Discussion