to-base64

The to-base64 operation encodes a value into Base64, a way of writing anything as plain ASCII text. You need it when an API asks for it, and almost the only time it asks is for authentication.

How it works

Value: hello         Result: aGVsbG8=
Value: 12345         Result: MTIzNDU=
Value: {"id":1}      Result: eyJpZCI6MX0=

An empty value gives an empty result.

Basic authentication

This is the common use, and it takes three steps because the header carries one encoded string rather than two values.

  1. A Set node joins the credentials with a colon between them, for example {client_id}:{client_secret}, into a field of its own.
  2. A Modify Field step runs to-base64 on it.
  3. The header on the request reads Authorization: Basic {auth}.

The prefix is Basic , with a trailing space. Not Bearer , which goes in front of a token that is already usable as it stands and never gets encoded. Mixing the two up is the most frequent reason an authentication header is refused.

See prefix and HTTP request.

It is not encryption

Base64 hides nothing. Anyone who sees the encoded string can decode it in a second, and from-base64 will do it for you.

It exists to make arbitrary data safe to put in a text field, not to protect it. Treat an encoded secret exactly as carefully as you would treat the secret itself.

When not to use it

Only encode when the other side specifically asks for it. Sending Base64 to an API that expected plain text gives you a rejection with an unhelpful message, because to them the value simply looks wrong.

Bear in mind it also makes the data about a third larger, which matters if you are ever moving something big.

The other direction

To decode, use from-base64.

Reference

See PHP: base64_encode.

Insights that
helps you grow

  • Release notes 2026/07/31
    What’s new in PalDock? A lot of this month went into things you won’t see directly – query optimisation, indexing, and general tuning under the…
  • Free Affiliate tracking software
    Many companies (inlcuding YOU) search for free affiliate tracking software because they want to launch an affiliate program without committing to expensive monthly fees. The…
  • Release notes 2026/06/30
    We implemented numerous performance improvements and feature enhancements based on your feedback. We also significantly expanded the flexibility of the following features: The External Final Page…