💡 Tips Numbers & Math

Number Base Converter: Pro Tips for Developers

Advertisement
🔢
Number Base Converter

Convert between binary, decimal, hex, and octal — all four views at once.

Use this tool →

Learn the hex digits for 0–15 by heart

The 16 hex digits and their decimal/binary equivalents: 0=0000, 1=0001, 2=0010, 3=0011, 4=0100, 5=0101, 6=0110, 7=0111, 8=1000, 9=1001, A=1010, B=1011, C=1100, D=1101, E=1110, F=1111. Knowing these lets you convert hex to binary and back mentally — each hex digit is exactly four binary bits.

Hex colour codes — understanding the structure

A six-character hex colour #RRGGBB splits into three two-digit hex pairs. #FF6B6B = R:FF(255) G:6B(107) B:6B(107). Two identical hex digits always give a range from 0 (00) to 255 (FF). A shorthand three-character code #RGB expands by doubling each digit: #F6B = #FF66BB. Useful to know when reading design tokens or debugging CSS variables.

Unix permissions in octal

chmod uses octal because three bits map perfectly to read (4), write (2), execute (1). Adding these values gives 0–7 for each of the three permission groups (owner, group, others). chmod 644 = owner:6(rw-) group:4(r--) others:4(r--). chmod 755 = owner:7(rwx) group:5(r-x) others:5(r-x). The converter shows the binary equivalent, which makes the bit structure immediately visible.

Check if a number is a power of 2 in binary

Powers of 2 always appear as a single 1 followed by zeros in binary: 1, 10, 100, 1000, 10000... (1, 2, 4, 8, 16...). If you need to check whether a number is a power of 2 in code, the classic bit trick is (n & (n-1)) === 0 — visible immediately if you convert both n and n-1 to binary and see the pattern.

Advertisement
🔧
Use the tool
Number Base Converter
📖
📖 Full Guide →
Number Base Converter
❓
Frequently Asked Questions
Common questions about Number Base Converter

📦 Recommended Resources

Handpicked books and tools — links may earn a small commission at no cost to you.