base64.b16encode()
base64.b16encode() is a Python function in the Base64 Module category. Encodes bytes to base16 (hexadecimal). The syntax is base64.b16encode(s). Returns: Base16 bytes. A typical example: base64.b16encode(b"hello") # b"68656C6C6F". A close sibling is base64.b64encode(), which encodes bytes-like object to base64 bytes. A close sibling is base64.b64decode(), which decodes base64 bytes back to original bytes. A close sibling is base64.urlsafe_b64encode(), which uRL-safe base64 encoding (+ → -, / → _). A close sibling is base64.urlsafe_b64decode(), which uRL-safe base64 decoding. More about this category: Base64/base32/base16 encoding — b64encode, b64decode, urlsafe. For a broader walkthrough, read the Base64 Module guide. Related Base64 Module entries: base64.b64encode(), base64.b64decode(), base64.urlsafe_b64encode(), base64.urlsafe_b64decode(), base64.b32encode(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try base64.b16encode() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.