binascii.b2a_base64()
binascii.b2a_base64() is a Python function in the Binascii Module category. Converts bytes to base64 ASCII string. The syntax is binascii.b2a_base64(data, newline=True). Returns: Base64 bytes. A typical example: binascii.b2a_base64(b"hello") # b"aGVsbG8=\n". A close sibling is binascii.hexlify(), which converts bytes to hexadecimal representation (like bytes.hex()). A close sibling is binascii.unhexlify(), which converts hexadecimal representation back to bytes. A close sibling is binascii.crc32(), which computes CRC-32 checksum of data (for error detection, not security). A close sibling is binascii.a2b_base64(), which converts base64 ASCII string to bytes (alternative to base64.b64decode). More about this category: Binary data conversions — hexlify, unhexlify, crc32, base64. Related Binascii Module entries: binascii.hexlify(), binascii.unhexlify(), binascii.crc32(), binascii.a2b_base64(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try binascii.b2a_base64() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.