Convert the number into hex than use `echo` to print the according byte sequence and pipe that into `base64`. So to encode the integer 10 with base64, you can use:

    echo -en '\xA' | base64

To explain the result. The byte 10 has the following binary representation:

    00001010

What base64 does is, it chunks those into groups of 6 bits. So with padding we get the following two 6lets:

    000010 100000

Which in decimal are 2 and 32, which correspond to the letters C and g.