HEX2BIN Function in Google Sheets

Convert a hexadecimal number to a binary number using the HEX2BIN function.

HEX2BIN Function

The HEX2BIN function in Google Sheets converts a hexadecimal number to its binary equivalent.

Syntax

HEX2BIN(signed_hexadecimal_number, [significant_digits])
  • signed_hexadecimal_number`: The hexadecimal number you want to convert. This is a required parameter.
  • significant_digits`: (Optional) The number of digits you want the binary number to contain.

Examples

  1. Basic Conversion

Convert the hexadecimal number ‘A’ to binary:

=HEX2BIN("A")

This will output 1010.

  1. Conversion with Significant Digits

Convert the hexadecimal number ‘A’ to binary with 8 significant digits:

=HEX2BIN("A", 8)

This will output 00001010.

  1. Conversion of a Negative Number

Convert the hexadecimal number ‘-F’ to binary:

=HEX2BIN("-F")

This will output 1111110001.

Notes

  • The HEX2BIN function can handle hexadecimal numbers up to 10 characters long.
  • If significant_digits is provided, the binary result will be padded with leading zeros to match the specified length.
  • HEX2DEC: Convert a hexadecimal number to a decimal number.
  • HEX2OCT: Convert a hexadecimal number to an octal number.