base64decode Synchronous

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

Recover the original byte string from a standard Base64 value. This is useful after reading binary content from a JSON document or receiving it through a text-only endpoint.

Syntax
Luau
base64decode(data: string) -> string

Parameters

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

Returns

string

The decoded bytes as a Luau string, including any embedded zero bytes.

Usage notes

Malformed input raises an error. This decoder rejects whitespace, URL-safe substitutions, and missing required padding; use pcall for data you do not control.

Example

Example
Luau
local ok, bytes = pcall(base64decode, "aGVsbG8=")
if ok then
    print(bytes) -- hello
end
Kawaii documentation