Log inGet started

base64

Updated 5 September 2026

The base64 namespace — 7 functions.

globals/base64/decode

base64.decode(text: string) -> (string?, string?)

Decode standard-alphabet base64 text back to the original binary string.

Parameters

  • text string — Base64 text to decode.

Returns (string?, string?) decoded bytes on success, or (nil, errmsg).

local bytes = base64.decode(text)

globals/base64/encode

base64.encode(bytes: buffer | string) -> string

Encode a binary string to standard-alphabet (padded) base64 text.

Parameters

  • bytes buffer | string — Binary bytes to encode.

Returns string — Base64 text.

local text = base64.encode(jpegBytes)

modules/base64/README

require("@builtin/modules/api/engine/base64") -- base64 (also available as global 'base64')

Base64 encode / decode between binary and text Luau strings (standard RFC 4648 alphabet, padded). Public Luau surface over the __base64 Internal FFI namespace.

Usage: local base64 = require("@builtin/modules/api/engine/base64") Also available as global: base64

modules/base64/decode

decode(text: string): (string?, string?)

Decode standard-alphabet base64 text back to the original binary string.

Parameters

  • text string — Base64 text to decode.
local bytes = base64.decode(text)

modules/base64/encode

encode(bytes: buffer | string): string

Encode a binary string to standard-alphabet (padded) base64 text.

Parameters

  • bytes buffer | string — Binary bytes to encode.
local text = base64.encode(jpegBytes)

typed/builtin//modules/api/engine/base64/base64/decode

base64.decode(text: string) -> (string?, string?)

Decode standard-alphabet base64 text back to the original binary string.

Parameters

  • text string — Base64 text to decode.

Returns (string?, string?) decoded bytes on success, or (nil, errmsg).

local bytes = base64.decode(text)

typed/builtin//modules/api/engine/base64/base64/encode

base64.encode(bytes: buffer | string) -> string

Encode a binary string to standard-alphabet (padded) base64 text.

Parameters

  • bytes buffer | string — Binary bytes to encode.

Returns string — Base64 text.

local text = base64.encode(jpegBytes)
  • api
  • reference