Skip to main content

base64_decode

Python API reference for the function encoding.base64_decode.

Public API

Function: base64_decode

Canonical path: encoding.base64_decode

Declared in: encoding.py

Signature

def base64_decode(string): ...

Summary

Base64 decode a URL-safe string of bytes or text. The result is bytes.

Behavior

The function converts the input string to bytes using ASCII encoding, ignoring errors, and appends padding characters to ensure the length is a multiple of four before decoding.

Parameters

  • string: A URL-safe string of bytes or text to be decoded.

Returns

  • Return value 1: The decoded data as bytes.

Errors

Raises BadData if the base64-encoded data is invalid.