Python : base64.b64encode()

Encode a string using Base64.


Function

base64.b64encode(bytes[, altchars])

Parameters

- bytes is the data to be encoded (must be a bytes-like object).
- The optional altchars parameter must be a bytes-like object of at least two characters and defines an alternative alphabet to replace the + and / characters.

Return value

Returns the Base64-encoded bytes. A TypeError is raised if the input is not a bytes-like object.

Example

<<< import base64
<<< text = 'base64 string'
<<< encoded = base64.b64encode(text)
<<< encoded

Home Page Base64encode List Privacy Policy About Us Contact

This website uses cookies to enhance your experience, personalize content and ads, and analyze our traffic.

©2025 Design by base64encodeonl.com