MySQL CONV() base conversion

CONV(N, from_base, to_base) converts a number between bases. MySQL supports bases from 2 through 36.

SELECT CONV(N, from_base, to_base);

Hexadecimal to binary

SELECT CONV('B', 16, 2);
1011

Octal to decimal

SELECT CONV(11, 8, 10);
9

Octal 11 equals decimal 9 because 1×81 + 1×80 = 9.

Hexadecimal to binary

SELECT CONV('D', 16, 2);
1101

Decimal to hexadecimal

SELECT CONV(10, 10, 16);
A

Decimal to octal

OCT() is equivalent to converting from base 10 to base 8.

SELECT OCT(7); -- Output: 7
SELECT OCT(8); -- Output: 10
SELECT OCT(9); -- Output: 11
SELECT OCT(10); -- Output: 12



Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer