Overview
This node provides Base64 encoding and decoding functionality. It can convert plain text into its Base64 representation or decode a Base64 string back to plain text. This is useful in scenarios where data needs to be safely transmitted or stored in text form, such as embedding binary data in JSON, sending data over protocols that only support text, or handling simple encryption-like transformations.
Practical examples:
- Encoding a password or token before sending it to an API that requires Base64 encoded credentials.
- Decoding Base64 encoded content received from an external service to retrieve the original text.
Properties
| Name | Meaning |
|---|---|
| Operation | Choose between "Encode" (convert text to Base64) or "Decode" (convert Base64 to text). |
| Text | The input string to process. For "Encode", this is the plain text to encode. For "Decode", this is the Base64 string to decode. |
Output
The node outputs an array of items, each containing a json object with a single property:
result: A string representing the processed output.- If encoding,
resultcontains the Base64 encoded version of the input text. - If decoding,
resultcontains the decoded plain text from the Base64 input.
- If encoding,
No binary data output is produced by this node.
Dependencies
- No external services or API keys are required.
- The node uses Node.js Buffer for Base64 encoding and decoding internally.
- No special n8n environment variables or configurations are needed.
Troubleshooting
- Invalid Base64 string error: When decoding, if the input is not a valid Base64 string, the node throws an error indicating "Invalid Base64 string". To resolve this, ensure the input string is correctly Base64 encoded without extra characters or whitespace.
- Empty input: Providing an empty string as input will result in an empty output string. Make sure the input text is not empty when encoding or decoding.
- Encoding vs Decoding confusion: Verify that the operation selected matches the input type; do not try to decode plain text or encode already Base64 encoded strings.