如何计算Base Conversion
learn.whatIsHeading
A number base converter converts integers between any base from 2 to 36. Binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) are the most used in computing.
公式
Base n to decimal: Σ (digit × n^position); Decimal to base n: repeatedly divide by n, collect remainders
- n
- Number base (2-36)
- d
- Digit value
- p
- Digit position (rightmost = 0)
分步指南
- 1To convert from base n to decimal: each digit × nᵖᵒˢⁱᵗⁱᵒⁿ, sum all
- 2Decimal to base n: repeatedly divide by n, collect remainders in reverse
- 3Digits above 9 use letters: A=10, B=11... Z=35
- 4Hex ↔ Binary: each hex digit = exactly 4 bits
例题解析
输入
Decimal 42 to binary
结果
42÷2=21r0; 21÷2=10r1; 10÷2=5r0; 5÷2=2r1; 2÷2=1r0; 1÷2=0r1 → 101010
常见问题
Why do we use bases other than 10?
Computers use binary (base 2) and hexadecimal (base 16) for efficiency. Octal (base 8) was historically used in early computing.
What does hexadecimal stand for?
Hexadecimal means 16 (hex- = 6, -decimal = 10). It uses digits 0-9 and letters A-F.
How do I convert hex to binary quickly?
Each hex digit equals exactly 4 binary bits. F = 1111, A = 1010, etc.