MySQL | BIN() Function Read Courses Improve Improve Improve Like Article Like Save Article Save Report issue Report The BIN() function in MySQL is used to convert a decimal number to its binary equivalent.The BIN() function is equivalent to the CONV() function written in the format CONV(number,10,2). In this format CONV() function converts the number ‘number’ from base 10(decimal) to base 2(binary). It is important to note that the BIN() function can only be used with positive integers. If you try to use a negative number or a non-integer value as the input to the BIN() function, MySQL will return an error. Syntax : BIN(decimal_number) Parameters Used: Here, decimal_number is the decimal number that you want to convert to binary. Return Value: The BIN() function returns a string value, the binary equivalent of the decimal number passed as argument. It returns NULL if the number is NULL. Examples: Converting 5 to its binary equivalent. Syntax: Output:'101' Converting 12 to its binary equivalent. Syntax: Output:'1100' Converting 97 to its binary equivalent. Syntax: Output:'1100001' Last Updated : 18 Apr, 2023 Like Article Save Article Previous How and When To Use SLEEP() Correctly in MySQL? Next MySQL | DATABASE() and CURRENT_USER() Functions Share your thoughts in the comments Add Your Comment Please Login to comment...