Base64
AI-generatedOverview
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, embedding images or files in JSON, or decoding Base64 strings received from external sources.
For example:
- Encoding a JSON string to Base64 before sending it to an API that requires encoded payloads.
- Decoding a Base64 string received from a webhook to retrieve the original content.
Properties
| Name | Meaning |
|---|---|
| Action | Choose between "Base64 Encode" (convert a string to Base64) or "Base64 Decode" (convert Base64 string back to original). |
| 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 this option is enabled. |
Output
The output contains the input data with an additional property (as specified by "Output Property Name") holding the encoded or decoded string result.
- The output is structured as JSON objects.
- If the output property name includes dots (e.g.,
data.result), nested properties are created accordingly. - Binary data is preserved if present in the input but not modified by this node.
Example output JSON snippet if outputPropertyName is "data":
{
"data": "SGVsbG8gd29ybGQ=" // Base64 encoded string or decoded string depending on action
}
Dependencies
- No external services or API keys are required.
- Uses Node.js Buffer class for Base64 operations.
- Requires n8n environment with standard workflow execution capabilities.
Troubleshooting
- Invalid Base64 string error: When decoding, if the input is not valid Base64 or the JSON parse option is enabled but the decoded string is not valid JSON, an error will occur. To fix, ensure the input is correctly Base64 encoded and disable JSON parse if the content is not JSON.
- Empty or missing input value: The node expects a non-empty string in the "Value" property. Providing empty input may lead to unexpected results.
- Output property path issues: Using invalid or conflicting output property names (especially with dots) might overwrite existing data unintentionally. Use unique property names to avoid conflicts.
