# JOSE Base64

JOSE Base64 is defined as:

> - URL-safe Base64

> - padding stripped

josepy.b64.b64encode(data: bytes) → bytes

  JOSE Base64 encode.

  Parameters:

    data (bytes) – Data to be encoded.

  Returns:

    JOSE Base64 string.

  Return type:

    bytes

  Raises:

    TypeError – if `data` is of incorrect type

josepy.b64.b64decode(data: bytes | str) → bytes

  JOSE Base64 decode.

  Parameters:

    data (bytes or unicode) – Base64 string to be decoded. If it’s unicode, then only ASCII characters are allowed.

  Returns:

    Decoded data.

  Return type:

    bytes

  Raises:

    - TypeError – if input is of incorrect type

    - ValueError – if input is unicode with non-ASCII characters