Guide · Security
How to Convert Binary, Decimal, Hex, and Octal
Updated 2026-08-08 · 4 min read
Same integer, different alphabet. 255 in decimal is FF in hex, 377 in octal, and 11111111 in binary. Developers hit this when a color is #1a2b3c, a bitmask is 0b1010, a Unix mode is 755, or a register dump is hex and the ticket is decimal.
DevOkk’s Number Converter does the change of base in the browser. It will not interpret C types, endianness, or floating point. Those are separate mistakes with the same hex digits.
Why you convert bases at all
Computers are binary. Humans like decimal. Hex is a compact way to write bytes (two hex digits = one byte). Octal survived because it maps neatly to 3-bit groups - which is why Unix permissions still look like 644.
You convert when two tools disagree about spelling, not when they disagree about math. 0x10 is sixteen, not ten. 10 in binary is two. The converter’s job is to stop you from doing that in your head at 1 a.m.
This is not encoding in the Base64 sense and not hashing. Hex is a numeral system. A SHA-256 digest looks like hex because we print bytes that way. Converting deadbeef as a number is valid and usually the wrong tool if you meant “checksum this file.”
Binary, octal, decimal, hex - the useful facts
Binary (base 2). Each digit is a bit. Useful for flags: bit 0 set, bit 3 set → 0b1001. Count bits from the right, starting at 0, unless a datasheet says otherwise.
Octal (base 8). Digits 0–7. Each octal digit is exactly three bits. 7 is 111. 755 as permissions is 111 101 101.
Decimal (base 10). What the ticket writer used. Also what JS Number uses until you hit integers larger than Number.MAX_SAFE_INTEGER (2⁵³−1). Past that, you need BigInt or you will silently round.
Hexadecimal (base 16). Digits 0–9 and A–F (case-insensitive). One hex digit is four bits, a nibble. Two hex digits are a byte. #FF00AA is three bytes. IPv6 and UUIDs are hex; they are formatted strings, not single integers you should paste in full without thinking.
DevOkk also offers base 32 and 36. Base 36 is 0–9 plus a–z, which shows up in compact ids. It is not Base64.
A debugging pass you can reuse
Colors. #1a2b3c is three hex bytes: 1a, 2b, 3c. Convert each to decimal if a design tool wants rgb(26, 43, 60). Do not convert 1a2b3c as one big integer unless you meant that.
Bitmasks. API says flags=10 and the docs list hex constants. Confirm whether 10 is decimal ten or hex 0x10. Then look at bits. A converter that shows binary next to hex pays for itself here.
Unix modes. Source base 8. 644 → binary 110100100 → rw-r--r--. If you leave the source on decimal, you will “convert” a permission into nonsense and chmod the wrong thing.
UUIDs and hashes. You rarely convert a whole UUID as one integer. You might inspect the version nibble (see UUID versions). For a digest, compare hex strings; do not convert SHA-256 to decimal for fun.
Coursework. Powers of two: 2¹⁰ = 1024. Hex 0x400 is 1024. If the problem says “show your work,” the converter is a check, not the writeup.
Steps in the tool:
- Open Number Converter.
- Set the from base to match the input’s real base, not the base you wish it was. Strip
0x,0b,0o, and spaces. - Read the outputs. Copy the one the next tool wants.
- If the value has a sign or a fixed width, handle that outside the converter (see below).
Prefixes, width, and signed values
Prefixes are notation. 0x, $ (old assemblers), h suffix, % for binary in some assemblers. The converter wants digits.
Leading zeros are for humans (0x00FF vs 0xFF). They do not change the integer. They do change how you think about width. A byte that must stay eight bits should be written with two hex digits when you paste it back into a firmware tool.
Signed integers. 0xFFFFFFFF is 4294967295 as unsigned 32-bit and −1 as two’s complement 32-bit. A generic base converter usually gives you the unsigned reading. If the protocol is signed, interpret it with a known width. Do not guess.
Endianness. 0x1234 stored as 34 12 on the wire is a byte-order problem, not a base problem. Convert after you have assembled the integer in the correct order.
Fractions. 0.1 in decimal is a repeating binary fraction. This tool is for integers. Floating-point surprises belong in a different calculator.
Limits of a browser converter
Very long bit strings will get unwieldy in a text field. Group them (bytes, words) before you paste.
If you needed a file-size conversion (KiB vs KB), that is SI versus IEC prefixes, not base 2 versus base 10 of an arbitrary integer - see the bytes/bits guide in related articles.
If you needed a cryptographic digest, Hash Generator is the next click. Hex output from a hash is not “the number in hex” in a useful arithmetic sense; it is a fingerprint.
The converter will not upload your homework. It also will not make a grade out of a wrong source base. Set the from-base explicitly every time.
Convert the spelling, leave the meaning alone
Paste the value into Number Converter with the correct source base, copy the spelling the other tool wants, and move on.
If the hex was a UUID, generate or inspect ids with UUID Generator. If it was a checksum, use Hash Generator. Bases are spelling. The rest of the stack is meaning.
Frequently asked questions
What does ‘base’ mean here?
How many digits the system uses before rolling over. Binary is base 2 (0, 1). Octal is 8 (0–7). Decimal is 10. Hexadecimal is 16 (0–9, A–F). Same integer, different spelling.
Why do I keep seeing `0x` and `0b`?
Language prefixes: 0xFF is hex, 0b1010 is binary, 0o755 is octal in modern JavaScript. The prefix is not part of the value. Strip it before pasting into a converter that expects raw digits.
Is hex the same as a hash?
No. Hashes are often displayed as hex, but hex is only the spelling. a3f2 as a color or a byte is not SHA-256. Use Hash Generator when you need a digest, Number Converter when you need a base change.
How do I convert a two’s-complement negative?
A browser converter that treats the input as an unsigned integer will not give you -5 from a 32-bit 0xFFFFFFFB unless it knows the width. Decide the bit width first, then interpret sign.
Why is `755` a thing in permissions?
Unix file modes are octal. 755 means rwx for owner, rx for group and others. If you convert 755 as decimal, you get the wrong bits. Set the source base to 8.
Does conversion happen in the browser?
Yes. Number Converter converts in the tab - binary, octal, decimal, hex, plus base 32 and 36. No account. Handy on a shared lab machine where you do not want to install another calculator.
Related guides
More reading that links back to the same tools and workflows.
UUID Versions Explained: v1, v3, v4, and v5
Pick a UUID version and generate IDs locally.
5 min read
How to Convert Bytes, Bits, KB, MB, and GB
SI vs binary prefixes for storage. Convert locally while debugging downloads.
4 min read
Password Generator vs Password Manager: Random Strings Are Not Storage
A generator makes one strong secret. A manager remembers unique secrets per site. Why you still need both, and why an online generator that phones home is the wrong half.
7 min read
Base64 Is Not Encryption: Encoding vs Secrets
Base64 hides nothing. Why people treat it like a cipher, what it is actually for (data URLs, JWTs, APIs), and how to encode or decode in the browser without uploading a key.
7 min read