github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/base64decode.mdx (about) 1 --- 2 page_title: base64decode - Functions - Configuration Language 3 description: The base64decode function decodes a string containing a base64 sequence. 4 --- 5 6 # `base64decode` Function 7 8 `base64decode` takes a string containing a Base64 character sequence and 9 returns the original string. 10 11 Terraform 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 Terraform language are sequences of unicode characters rather 15 than bytes, so this function will also interpret the resulting bytes as 16 UTF-8. If the bytes after Base64 decoding are _not_ valid UTF-8, this function 17 produces an error. 18 19 While we do not recommend manipulating large, raw binary data in the Terraform 20 language, Base64 encoding is the standard way to represent arbitrary byte 21 sequences, and so resource types that accept or return binary data will use 22 Base64 themselves, which avoids the need to encode or decode it directly in 23 most cases. Various other functions with names containing "base64" can generate 24 or manipulate Base64 data directly. 25 26 `base64decode` is, in effect, a shorthand for calling 27 [`textdecodebase64`](/language/functions/textdecodebase64) with the encoding name set to 28 `UTF-8`. 29 30 ## Examples 31 32 ``` 33 > base64decode("SGVsbG8gV29ybGQ=") 34 Hello World 35 ``` 36 37 ## Related Functions 38 39 * [`base64encode`](/language/functions/base64encode) performs the opposite operation, 40 encoding the UTF-8 bytes for a string as Base64. 41 * [`textdecodebase64`](/language/functions/textdecodebase64) is a more general function that 42 supports character encodings other than UTF-8. 43 * [`base64gzip`](/language/functions/base64gzip) applies gzip compression to a string 44 and returns the result with Base64 encoding. 45 * [`filebase64`](/language/functions/filebase64) reads a file from the local filesystem 46 and returns its raw bytes with Base64 encoding.