How to convert text to base64

Hi @Lucas, welcome to the community! Hope you’re well?

As you have noticed, the Crypto node would not cover just de- or encoding base64.

So you would need to convert a string using either JavaScript snippet (e.g. through the Set or Function Item node) or using any binary on your server via the Execute Command node. A JavaScript-based workflow could look like so (you can just copy the below JSON code right into your n8n canvas to see the workflow):

This sets a clear text message in the Set node and then converts it to base64 in the Function Item node.

Hope this helps :slight_smile:

1 Like