Binary / Hex / Decimal Converter
Convert a number between binary, octal, decimal and hexadecimal, with a breakdown table.
Results update as you type.
Game da wannan Kalkulator
A binary, hex and decimal converter shows the same whole number across number bases. Computers ultimately work in binary (base 2), but programmers routinely switch between bases to make values readable: decimal (base 10) for everyday quantities, hexadecimal (base 16) for byte values and memory addresses, and octal (base 8) for things like Unix file permissions. This converter takes a whole number in any of those four bases and shows it in all four at once, along with its bit length. The digits allowed in each base go up to one less than the base — binary uses 0–1, octal 0–7, decimal 0–9 and hex 0–9 then A–F for 10–15 — and the tool rejects digits that are out of range for the base you pick.
As a worked example, the decimal value 255 is FF in hexadecimal, 377 in octal and 11111111 in binary — eight bits all set, i.e. exactly one byte at its maximum. To convert decimal to hex by hand you repeatedly divide by 16 and read the remainders from last to first; the calculator does it instantly and also accepts input prefixed with 0x (hex), 0b (binary) or 0o (octal) and handles negative numbers.
The reason hexadecimal is so common in computing is that each hex digit maps to exactly four binary bits (a nibble), so two hex digits describe one byte with no ambiguity — which is why colour codes like #FF8800, MAC addresses and memory dumps are written in hex. This tool is handy for bit masks, colour values, debugging register contents and any low-level work where you need to see the same number across bases.
Tambayoyi da ake yi da yawa
Yadda zan canza lissafi zuwa hexadecimal?
Repeatedly divide by 16 and read the remainders from last to first, using A–F for 10–15. Decimal 255 is FF in hex and 11111111 in binary.
Me ya sa ake amfani da hexadecimal a cikin lissafi?
Each hex digit maps to exactly four binary bits, so hex is a compact, readable way to write byte values and memory addresses — 0xFF is one byte of all ones.
Shin zan iya shigar da lissafi da 0x, 0b ko 0o?
Yanzu, za'a cire wani farkon 0x (hexadecimal), 0b (binary) ko 0o (octal) da aka yi amfani da shi, don haka zaka iya sanya kimar daga lissafi. Ka tabbata cewa tushen shigarwa da ka zaba ya dace da adadin da ka shigar.
Menene tsayin bit ɗin ke gaya mini?
Wannan shi ne adadin adadin biyu da kimar ke bukata. 255 na ɗari na 8 bits (bayt daya); 256 yana bukatar bita 9. Faɗin bita yana da amfani ga zaɓar nau'ikan bayanai da kuma duba ko kimar tana cikin bayt, 16-bit kalma ko 32-bit rajista.
Me ake amfani da shi don octal?
Octal na ƙungiyoyin bita cikin uku kuma yana nuna a cikin izinin fayil na Unix (kamar 755 ko 644) da wasu tsarin da aka riga aka yi. Duk wani adadin octal yana nuna zuwa daidai bita biyu uku, hanyar da kowane adadin hex yana nuna zuwa huɗu.
Me ya sa na samu "alama mara kyau ga wannan tushe"?
Wani adadin da ka shigar ba'a yarda da shi a cikin tushen da aka zaɓa ba - misali, harshen F ko adadin 8 cikin lamba biyu, wanda kawai yana yarda da 0 da 1. Sauya tushen shigarwa don ya haɗu da kimarka, ko gyara adadin da ke waje daga zauren.
API — amfani da wannan calculator daga code
Ka kira wannan kwalban kamar wata maɓallin ƙarshe JSON mai kyauta - babu maɓalli da ake buƙata. Ka aika kimar fannin ƙasa kamar paramita na tambaya ko JSON. Anything you omit uses the same default this page is pre-filled with; an unknown parameter is a 400, never a silent zero. Read the full API docs →
Endpoint
GET https://calculator.free/api/v1/binary-hex/
curl
curl "https://calculator.free/api/v1/binary-hex/?value=255&base=10"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/binary-hex/?" + new URLSearchParams({
"value": "255",
"base": "10"
}));
const data = await r.json();
console.log(data.results);
Results are estimates for general guidance only, not financial, medical or tax advice.