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