Overview
The base64 node encodes binary data to Base64 strings or
decodes Base64 strings back to their original form. Base64 encoding is essential when you need
to transport binary data (images, files, buffers) through text-based protocols like JSON APIs,
MQTT payloads, or HTTP headers. The node also supports URL-safe Base64 encoding for use in
URLs and query parameters.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| operation | string | "encode" | Operation: "encode" (binary to Base64) or "decode" (Base64 to binary) |
| urlSafe | boolean | false | Use URL-safe Base64 (replaces + with - and / with _) |
| property | string | "payload" | Message property to encode or decode |
Encoding Formats
Standard Base64
Uses the standard alphabet with + and / characters. Padded with = signs. Suitable for JSON bodies, headers, and storage.
// Input: "Hello, EdgeFlow!"
// Output: "SGVsbG8sIEVkZ2VGbG93IQ=="
// Uses: A-Z, a-z, 0-9, +, / URL-Safe Base64
Replaces + with - and / with _ to avoid URL encoding issues. No padding. Safe for query parameters and file names.
// Input: "Hello, EdgeFlow!"
// Output: "SGVsbG8sIEVkZ2VGbG93IQ"
// Uses: A-Z, a-z, 0-9, -, _ Example: Encode Image Data for API Upload
Read an image file, encode it as Base64, and include it in a JSON API request body.
// Base64 node configuration
{
"operation": "encode",
"urlSafe": false,
"property": "payload"
}
// Flow: [File Read] -> [Base64 Encode] -> [Change] -> [HTTP Request]
//
// Step 1: File Read node reads image as Buffer
// msg.payload =
// msg.filename = "sensor-capture.png"
//
// Step 2: Base64 node encodes to string
// msg.payload = "iVBORw0KGgoAAAANSUhEUgAA..."
//
// Step 3: Change node wraps in API format
// msg.payload = {
// "image": msg.payload,
// "filename": msg.filename,
// "contentType": "image/png",
// "timestamp": "2025-01-15T10:30:00Z"
// }
//
// Step 4: HTTP Request sends JSON to API Example: Decode Base64 Webhook Payloads
Decode incoming Base64-encoded data from webhook providers that encode their payloads.
// Base64 node configuration
{
"operation": "decode",
"urlSafe": false,
"property": "payload.data"
}
// Flow: [HTTP In] -> [Base64 Decode] -> [JSON Parse] -> [Process]
//
// Incoming webhook body:
// {
// "event": "device.update",
// "data": "eyJkZXZpY2VJZCI6InNlbnNvci0wMSIsInRlbXAiOjIyLjV9"
// }
//
// After Base64 decode:
// msg.payload.data = '{"deviceId":"sensor-01","temp":22.5}'
//
// After JSON parse:
// msg.payload.data = {
// "deviceId": "sensor-01",
// "temp": 22.5
// }
//
// The decoded data is now ready for processing Common Use Cases
Image & File Transport
Encode binary files for inclusion in JSON payloads, MQTT messages, or REST API bodies.
Webhook Processing
Decode Base64-encoded payloads from services like AWS SNS, Twilio, or IoT platforms.
Token Generation
Create URL-safe encoded tokens and identifiers for authentication workflows.
Data Embedding
Embed small binary assets (icons, certificates) directly in configuration payloads.