github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/encoding/base64encode.mdx (about) 1 --- 2 layout: docs 3 page_title: base64encode - Functions - Configuration Language 4 description: The base64encode function applies Base64 encoding to a string. 5 --- 6 7 # `base64encode` Function 8 9 `base64encode` applies Base64 encoding to a string. 10 11 Nomad uses the "standard" Base64 alphabet as defined in 12 [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4). 13 14 Strings in the Nomad language are sequences of unicode characters rather 15 than bytes, so this function will first encode the characters from the string 16 as UTF-8, and then apply Base64 encoding to the result. 17 18 The Nomad language applies Unicode normalization to all strings, and so 19 passing a string through `base64decode` and then `base64encode` may not yield 20 the original result exactly. 21 22 ## Examples 23 24 ```shell-session 25 > base64encode("Hello World") 26 SGVsbG8gV29ybGQ= 27 ``` 28 29 ## Related Functions 30 31 - [`base64decode`](/docs/job-specification/hcl2/functions/encoding/base64decode) performs the opposite operation, 32 decoding Base64 data and interpreting it as a UTF-8 string.