Number Base Converter: Tips & How-Tos
Best Practices
Programming Use
- Hexadecimal is the standard for colour codes and memory addresses. HTML/CSS colours like #FF5733 are hex: FF = 255 red, 57 = 87 green, 33 = 51 blue. Memory addresses in debuggers are almost always shown in hexadecimal.
- Prefix conventions identify the base of a literal. Most programming languages use 0x for hex (0xFF), 0b for binary (0b1010), and 0o for octal (0o17). No prefix means decimal. Recognising these prevents misreading values.
- Binary is the native language of all digital logic. Every computation in a CPU ultimately happens in binary. Understanding binary helps when working with bit flags, bitwise operators, and low-level hardware registers.
- Octal appears in Unix file permissions. Unix permission strings like chmod 755 use octal: 7 = rwx (111 binary), 5 = r-x (101 binary), 4 = r-- (100 binary). Converting the octal to binary directly reveals which permissions are set.
- Leading zeros matter in binary, not decimal. The decimal number 7 and 007 are the same; binary 00000111 and 111 are the same value but the zero-padded form shows the full byte width, which matters when reading memory or register contents.
Reading Output
- FF in hex = 255 in decimal = 11111111 in binary. These are the three most commonly used representations of the maximum value of a single byte. Memorising this relationship speeds up reading hex dumps and binary data.
- Bit flags are most readable in binary. A value of 0b00101100 immediately shows which bits are set (positions 2, 3, and 5), while the same value as 44 in decimal or 2C in hex is much harder to interpret at a glance.
- Hex digits map directly to 4-bit groups. Each hex digit represents exactly 4 binary bits (a nibble). 0xA = 1010, 0xF = 1111. Converting hex to binary is just substituting each hex digit with its 4-bit binary equivalent — no arithmetic needed.
How-to Guides
How to convert a decimal number to binary
A common requirement in computer science coursework and programming.
- Enter the decimal number in the Number Base Converter's input field.
- The binary equivalent appears immediately in the Binary output.
- To verify manually: divide the number repeatedly by 2 and record remainders from bottom to top. For 13: 13÷2=6 r1, 6÷2=3 r0, 3÷2=1 r1, 1÷2=0 r1 → binary = 1101.
How to read a hex colour code and find the RGB values
Decoding an HTML hex colour to its red, green, and blue components.
- Take the hex colour code (e.g. #4A90E2).
- Split it into three pairs: 4A (red), 90 (green), E2 (blue).
- Open the Number Base Converter and enter each pair as a hexadecimal number.
- 4A → 74 (red), 90 → 144 (green), E2 → 226 (blue).
- The RGB colour is rgb(74, 144, 226) — a medium blue.
How to decode Unix file permissions from octal
Understanding what chmod 755 or chmod 644 actually grants.
- Take the octal permission number (e.g. 755).
- Split into three digits: 7 (owner), 5 (group), 5 (others).
- Convert each octal digit to binary: 7=111, 5=101.
- Map to rwx: 111=rwx, 101=r-x.
- Result: owner has read/write/execute; group and others have read/execute only.
How to convert a memory address from hex to decimal
Reading a debugger output that shows addresses in hexadecimal.
- Note the hex address from the debugger (e.g. 0x1A4F).
- Remove the 0x prefix: 1A4F.
- Enter 1A4F into the Number Base Converter with Hexadecimal as the input base.
- The decimal equivalent appears: 6735.
- Use the decimal value when comparing to a decimal address range or offset.
How to understand a binary bit flag in a system log
Interpreting a bitmask value in a log file or API response.
- Identify the bitmask value in the log (e.g. 0x0C or 12 in decimal).
- Convert to binary using the converter: 12 → 00001100.
- Each bit position (from right, starting at 0) represents a flag: bits 2 and 3 are set.
- Look up what bits 2 and 3 mean in the system's documentation.
- This tells you which conditions or options are active.
How to convert between bases using mental shortcuts
Quickly converting small values without a tool.
- Hex → Binary: replace each hex digit with its 4-bit binary equivalent (A=1010, F=1111, 0=0000, etc.).
- Binary → Hex: group binary digits in fours from the right and replace each group with its hex digit.
- Decimal → Hex (small numbers): memorise 0–15 as 0–F. For larger numbers, divide by 16 repeatedly.
- Decimal → Binary: divide by 2 repeatedly and read remainders upward.
- These shortcuts work for values up to 255 (0xFF) without needing a calculator.
Use the Number Base Converter