JSON Object to Base64 String Encoder - n8n Workflow

Learn how to convert complex JSON objects into a single Base64 encoded string using this powerful n8n workflow template. Ideal for API data preparation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Developers needing to send encoded payloads to REST APIs.

  • Automation specialists requiring a reusable Base64 encoding function.

  • Users of n8n who want to standardize data transformations without custom code.

  • Individuals seeking efficient n8n templates for common utility tasks.

Overview

Base64 encoding is a foundational requirement in many modern integrations, particularly when authenticating with services, signing requests, or embedding data within specific protocols. Relying on external JavaScript or Python code within your automation platform can add unnecessary complexity. This n8n workflow provides a pure, zero-code solution using core n8n node functionality.

This specific n8n workflow structure demonstrates how to reliably take any complex JSON object, stringify it, treat the resulting string as binary data, and extract the clean Base64 representation. The three transformation nodes in this n8n workflow are highly reusable and can be easily wrapped into a sub-n8n workflow for deployment in multiple projects requiring this utility. This is a crucial n8n templates utility for robust API integration.

How it Works

The n8n workflow starts with a manual n8n trigger for immediate testing and demonstration.


  1. Data Creation: The 'Create Json Data' n8n node initializes a complex JSON object payload containing various data types (strings, numbers, nested objects, and arrays).

  2. Stringification: The 'Convert JSON to String' n8n node is the first critical step. It utilizes an expression ({{ JSON.stringify($json) }}) to reliably serialize the entire JSON input object into a single string called jsontext. This ensures the structure is maintained before encoding.

  3. To Binary Conversion: The 'Convert String to Binary' n8n node takes the jsontext string and transforms it into a temporary binary file object, naming the resulting binary property encodedtext. This conversion is necessary because n8n only performs Base64 extraction on binary data items.

  4. Base64 Extraction: Finally, the 'Extract Base64 from Binary' n8n node performs the core action. It reads the binary file item (encodedtext) and converts the content directly into a Base64 string, saving the result cleanly into a standard n8n workflow property named base64_text for subsequent use.

Installation Guide


  1. Import: Copy the provided n8n workflow JSON code.

  2. Access n8n: Navigate to your n8n instance and open the Workflows view.

  3. Create New: Click 'New' or 'Import from JSON' and paste the code.

  4. Execution: Since this n8n workflow uses a 'Manual Execution' n8n trigger, you can simply click the 'Execute Workflow' button to run the entire flow and view the resulting Base64 string in the last n8n node.

Node Details

Manual Execution (n8n trigger): Starts the n8n workflow manually for testing.
Create Json Data (Set n8n node): Creates the initial complex JSON object payload for testing purposes.
Convert JSON to String (Set n8n node): Uses the JSON.stringify expression to serialize the input data into a single string property (jsontext). This prepares the JSON structure for binary conversion, a key step in this n8n workflow.
Convert String to Binary (Convert To File n8n node): Converts the json
text string into a binary file format, named encodedtext. Configuration uses the 'toText' operation and 'utf8' encoding.


  • Extract Base64 from Binary (Extract From File n8n node): Reads the binary data from the encodedtext property and extracts the corresponding Base64 string, saving it to the output property base64_text. This efficient n8n node completes the encoding process.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Featured*