base64decode Synchronous

  • base64.decode
  • base64_decode
  • crypt.base64.decode
  • crypt.base64_decode
  • crypt.base64decode
  • syn.crypt.base64.decode
  • syn.crypto.base64.decode

Restore the original bytes from Base64 text. The result can be read as text or passed to a function that accepts binary strings. Use it to recover binary content received through a text format. Invalid Base64 raises an error, so handle decoding failures for user-supplied input.

Syntax
Luau
base64decode(data: string) -> string

Parameters

Function parameters
ParameterTypeDescription
datastringBase64 text using the standard + and / alphabet and correct = padding.

Returns

string

The decoded byte string, including any embedded zero bytes.

Usage notes

Malformed Base64 raises an error. Whitespace, URL-safe alphabet substitutions, and missing required padding are not accepted.

Example

Example
Luau
local decoded = base64decode("aGVsbG8=")
print(decoded) -- hello
Kawaii documentation