> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# base64_encode

> 使用 Base64 encoder 编码 Lua string 的字节，使用 = padding 且不插入换行。

<div className="real-function-page">
  ```lua theme={null}
  base64_encode(data: string): string
  ```

  ## 别名

  * `base64encode`
  * `base64.encode`
  * `crypt.base64.encode`
  * `crypt.base64_encode`
  * `crypt.base64encode`

  ## 参数

  <ParamField path={"data"} type={"string"} required>
    传递给 Base64 encoder 的 Lua string 字节。
  </ParamField>

  ## 返回值

  <ResponseField name={"encoded"} type={"string"}>
    以 Lua string 返回的 Base64 输出。
  </ResponseField>

  ## 示例

  编码一个 Lua string 并打印 Base64 输出。

  ```lua theme={null}
  local encoded = base64_encode("hello world")

  print(encoded)
  print(base64encode("hello world"))
  print(base64.encode("hello world"))
  ```
</div>
