Open this example in the interactive library
Source code
import base64
print(base64.b64encode(b'hello').decode('ascii'))Sample output
aGVsbG8=

Encode Base64 bytes. A self-contained example using the Python standard library.
Open this example in the interactive library
import base64
print(base64.b64encode(b'hello').decode('ascii'))aGVsbG8=