Converts an input value to base64 encoding with optional padding with an equals sign (=). Input can be of any type. Output type is String.


Column reference example:

base64encode(mySource)

Output: Returns the values from the mySource column written in base64 format. 

String literal example:

base64encode('Hello, World. ', true)

Output: Returns the string: GVsbG8sIFdvcmxkLiA=. Note that the output string is padded with the equals sign at the end of the output value. 

base64encode(column_string,bool_padding)


ArgumentRequired?Data TypeDescription
column_stringYstringName of the column or string literal to be applied to the function
bool_paddingNBooleanWhen true, excess padding in the data stream is padded with an equals sign ( =) in the output. Default is true.

column_string

Name of the column or string constant to be converted.

Required?Data TypeExample Value
YesString literal or column referencemyColumn

bool_padding

Boolean value that determines if spaces are padded with the equals sign. 

Base64 represents six-bit values (0-63). These values are represented in encoded values as ASCII characters, which are 8-bit values (0-255). 

For any arbitrary input, it is possible that the number of bits required to represent it as a base64 value (number of characters * 6) won't precisely match up ASCII representation. Four sextets of base64 encoding map to three octets of ASCII encoding. If the input string has been fully encoded, but there are extra ASCII octets so that the number of output octets is divisible by four. 

When this parameter is set to true, the output value is padded with the equals sign (=) to represent output octets that are generated but do not contain any data encoded from the input. The default is true.

For more information on base64 padding, see https://en.wikipedia.org/wiki/Base64


Required?Data TypeExample Value
NoBooleanfalse

Example - base64 encoding and decoding