Skip to main content

Base64 Encode

Encodes text into Base64 format for safe transmission and storage.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Text - The text string to encode into Base64 format. Cannot be empty.

Options

This node does not have any options.

Outputs

  • Result - The Base64 encoded string representation of the input text.

How It Works

The Base64 Encode node converts plain text into Base64 encoding format. When executed, the node:

  1. Receives text through the Text input
  2. Converts the text to bytes and applies standard Base64 encoding
  3. Outputs the encoded string through the Result output

Base64 encoding is commonly used to encode binary data as ASCII text, making it safe for transmission over text-based protocols.

Example Usage

Example 1: Encoding Credentials

Encode username and password for Basic Authentication:

// Input text: "username:password"
// Output: "dXNlcm5hbWU6cGFzc3dvcmQ="

This can be used in HTTP Authorization headers as Basic dXNlcm5hbWU6cGFzc3dvcmQ=.

Example 2: Encoding Binary Data

Encode file content or binary data for embedding in JSON:

// Input text: "Hello World!"
// Output: "SGVsbG8gV29ybGQh"

Example 3: Encoding Special Characters

Safely encode text with special characters:

// Input text: "user@example.com:p@ssw0rd!"
// Output: "dXNlckBleGFtcGxlLmNvbTpwQHNzdzByZCE="

Requirements

  • Non-empty text string as input

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - When the input text is empty

Usage Tips

  • API Authentication: Use Base64 encoding for Basic Authentication headers in HTTP requests
  • Data Transmission: Encode sensitive data before sending it over networks
  • Email Attachments: Base64 is commonly used for encoding email attachments
  • JSON Embedding: Encode binary data to safely embed it in JSON structures
  • URL Safety: While URL encoding is more appropriate for URLs, Base64 can encode any data for safe transmission
  • Reversible: Always use Base64 Decode node to retrieve the original text

Common Use Cases

  1. HTTP Basic Authentication: Encode username:password combinations
  2. API Keys: Encode API keys or tokens for transmission
  3. File Content: Encode file contents for inclusion in JSON or XML
  4. Image Data: Encode image data for data URIs in web applications
  5. Configuration Storage: Store sensitive configuration values in encoded form

Notes

  • Base64 encoding increases data size by approximately 33%
  • The encoding is NOT encryption - it's easily reversible and should not be used for security
  • Use proper encryption methods for securing sensitive data
  • Base64 is purely for encoding binary data as text, not for obfuscation
  • The output is always ASCII text safe for use in URLs, emails, and other text-based systems