By default, bc takes its input and prints its output in decimal. However, you can set either the input or the output to be some other base numbering system - for example, hexadecimal or binary - using the ibase and obase commands.
For example, to find the decimal equivalents to a hexadecimal number, set ibase to 16, and leave obase alone (i.e., as decimal). Simply type the number (or a series of numbers separated by semicolons) you want converted, and press RETURN. The decimal equivalent will be printed below. (Hexadecimal numbers from A to F must be typed in uppercase, or bc will report an error.) For example:
bc ibase=16 B6;7F;FFF182 127 4095
Or if you wanted to convert to hexadecimal, you'd set obase to 16, and leave ibase at 10:
bc obase=16 1428E
Or, to convert binary to hexadecimal, set
obase=2 for the reverse operation):
bc obase=16 ibase=2 11010001D1
Type CTRL-d to exit bc. Be careful to set obase before ibase, or you will have.