संख्या आधार कनवर्टर
बाइनरी, ऑक्टल, दशमलव और हेक्साडेसिमल के बीच कनवर्ट करें।
संख्या आधार समझना
संख्या आधार (या रेडिक्स) निर्धारित करता है कि संख्याओं का प्रतिनिधित्व करने के लिए कितने अनूठे अंक सेवा करते हैं। सबसे परिचित बेस 10 (दशमलव) है।
- बाइनरी (बेस 2): सभी डिजिटल सिस्टम द्वारा आंतरिक रूप से उपयोग की जाती है। प्रत्येक अंक एक "बिट" है।
- ऑक्टल (बेस 8): 0-7 अंकों का उपयोग करता है। Unix फ़ाइल अनुमतियों के लिए सामान्य (जैसे chmod 755)।
- दशमलव (बेस 10): मानक मानव संख्या प्रणाली।
- हेक्साडेसिमल (बेस 16): 0-9 और A-F का उपयोग करता है। रंगों (#FF0000), मेमोरी पतों और डेटा के प्रतिनिधित्व के लिए व्यापक रूप से उपयोग होता है।
अक्सर पूछे जाने वाले प्रश्न
क्या यह बहुत बड़ी संख्याओं का समर्थन करता है?
हाँ। यह टूल JavaScript BigInt का उपयोग करता है, जो बिना सटीकता के नुकसान के मनमाने ढंग से बड़े पूर्णांकों का समर्थन करता है।
कंप्यूटिंग में बाइनरी क्यों महत्वपूर्ण है?
कंप्यूटर दो-स्थिति विद्युत संकेत (चालू/बंद) का उपयोग करते हैं, जो स्वाभाविक रूप से बाइनरी (1/0) से मेल खाते हैं।
Positional Notation कैसे काम करती है
एक positional number system एक fixed-size set of digit symbols use करके number represent करता है, जहां हर digit की position उसका weight determine करती है। Position i का weight (right से count, zero से start) base^i है। Number की value सभी positions पर digit × base^i का sum है। Base 10 में string 352 का मतलब है 3×100 + 5×10 + 2×1 = 352। Base 2 में string 1011 का मतलब है decimal में 1×8 + 0×4 + 1×2 + 1×1 = 11।
Positional notation number representation में दो बड़े inventions में से एक है। दूसरा non-positional (Roman numerals, Egyptian hieratic) है, जहां symbols की position की परवाह किए बिना fixed values होती हैं। Positional systems compress करते हैं; non-positional नहीं, 1,888 decimal में four digits लेता है लेकिन Roman में eight characters: MDCCCLXXXVIII।
Bases का संक्षिप्त इतिहास
Babylonians कम से कम Old Babylonian period, approximately 1900-1600 BC के आसपास एक positional base-60 (sexagesimal) system run करते थे। उस era की Cuneiform tablets पहले से ही positional notation use करती हैं। 60 क्यों? इसके small divisors का uniquely high count है (1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60), जिससे pre-decimal-fraction world में fraction arithmetic easier था। Babylonian legacy अभी भी आपकी pocket में है: time (एक minute में 60 seconds, एक hour में 60 minutes) और angles / geographic coordinates (एक circle में 360 degrees, प्रति degree 60 minutes of arc, प्रति minute 60 seconds of arc) direct descendants हैं। जब आप clock या latitude read करते हैं, आप sexagesimal read कर रहे हैं।
जैसा कि हम जानते हैं decimal positional system Indian mathematicians द्वारा early centuries AD में develop किया गया था। इसे earlier counting boards से distinguish करने वाला conceptual leap zero के लिए एक written symbol जो placeholder के रूप में act करे था। Positional context में zero का सबसे पहला unambiguous use generally Brahmagupta (628 AD) को attributed है, जिनका treatise Brāhmasphuṭasiddhānta zero के साथ arithmetic के rules देता था। Bakhshali manuscript placeholder के रूप में एक dot (bindu) का even earlier use दिखाती है।
Decimal system 8th-9th century में India से Islamic world तक पहुंचा, Persian polymath al-Khwārizmī ने around 825 AD में On the Calculation with Hindu Numerals लिखी («algorithm» और «algebra» उनके name और book titles के direct etymological descendants हैं)। Europe पीछे रहा। Leonardo of Pisa, known as Fibonacci, ने formally Hindu-Arabic numerals को Latin Europe में Liber Abaci (1202) में introduce किया, Roman numerals पर उनकी superiority demonstrate करते हुए। Roman numerals 16th century तक European bookkeeping में बने रहे।
Gottfried Wilhelm Leibniz ने अपने 1703 paper Explication de l'arithmétique binaire में fully binary number system describe किया: हालांकि उनकी primary motivation philosophical थी (I Ching के साथ correspondence) practical नहीं। Binary computing तक jump Claude Shannon's 1937 master's thesis at MIT, «A Symbolic Analysis of Relay and Switching Circuits» के साथ आई, जिसने दिखाया कि Boolean algebra electrical relay networks model कर सकती है, binary को digital logic की natural language बनाते हुए।
Conversion Algorithms
Decimal से other base, repeated division। एक decimal integer N को base b में convert करने के लिए, N को b से divide करें, remainder record करें, N को quotient से replace करें, और तब तक repeat करें जब तक quotient 0 न हो जाए। Bottom-to-top पढ़े remainders base b में digits हैं। 156 को binary में convert करने का worked example: 156÷2 = 78 r0, 78÷2 = 39 r0, 39÷2 = 19 r1, 19÷2 = 9 r1, 9÷2 = 4 r1, 4÷2 = 2 r0, 2÷2 = 1 r0, 1÷2 = 0 r1, remainders bottom-up पढ़ना: 10011100। Verify: 128 + 16 + 8 + 4 = 156।
Other base से decimal, Horner's method। 0 से start करें; हर digit के लिए left-to-right, running total को base से multiply करें और new digit add करें। Hex 1F4 के लिए worked example: 0×16 + 1 = 1, फिर 1×16 + 15 = 31, फिर 31×16 + 4 = 500।
दोनों algorithms digits की number के relative linear time में run करते हैं, और JavaScript का BigInt hood के under उन्हें implement करता है, यही कारण है कि इस tool की कोई precision ceiling नहीं है। एक 200-digit number किसी भी दो bases के बीच बिना rounding loss के cleanly convert होता है, उसी तरह जैसे arbitrary-precision integer arithmetic वाला calculator।
Computing में Matter करने वाले चार Bases
- Binary (base 2): transistors on या off होते हैं, इसलिए binary digital logic के लिए natural representation है। हर piece of data, ultimately, binary है।
- Octal (base 8): historically early computing में common था क्योंकि 3 binary digits cleanly 1 octal digit पर map होते हैं। आज कम prominent है लेकिन Unix file permissions (
chmod 755) और कुछ legacy file formats में still use होता है। - Decimal (base 10): everyday human number system, almost certainly इसलिए कि हमारे दस fingers हैं। Financial systems, science, कहीं भी जहां humans numbers read करते हैं।
- Hexadecimal (base 16): exactly 4 bits per digit, मतलब 1 byte = 2 hex characters। Compact byte-level representation के लिए de facto standard: hex colour codes (
#FF0000), memory addresses (0x7fff...), Unicode code points (U+1F600), MAC addresses, hash digests।
याद रखने योग्य Powers of 2
| Power | Decimal | Hex | क्यों Important है |
|---|---|---|---|
| 2⁸ | 256 | 0x100 | एक byte; 8-bit channel (RGB) की max value |
| 2¹⁰ | 1,024 | 0x400 | Computing context में «1K» |
| 2¹⁶ | 65,536 | 0x10000 | UTF-16 BMP आकार; 16-bit integer max |
| 2²⁰ | 1,048,576 | 0x100000 | Computing context में «1M» |
| 2²⁴ | 16,777,216 | 0x1000000 | 24-bit RGB («16.7M colors») |
| 2³² | ~4.3 अरब | 0x100000000 | 32-bit unsigned integer max; IPv4 पता स्थान |
| 2⁶⁴ | ~1.8×10¹⁹ | 0x100… | 64-bit integer max; floating-point precision से बहुत आगे |
Base Converter कब Use करें
- Debugger, network packet capture, या binary file से hex dumps पढ़ना।
0xFFको अपने head में 255 में translate करना fine है;0x7F4Aआमतौर पर नहीं। - CSS colour codes:
#FF0000decimal (255, 0, 0) है। Hex-to-RGB conversion exactly base 16 → base 10 है हर two-character pair पर। - Unix file permissions:
chmod 755octal है: 7 = rwx (read+write+execute = 4+2+1), 5 = r-x (read+execute = 4+1), 5 again। हर octal digit exactly 3 binary bits है। - IPv4 octets:
192.168.1.1जैसे addresses चार 8-bit numbers हैं। Subnet masks binary में reason करना easier है (एक/24mask 24 ones followed by 8 zeros है)। - Unicode code points: characters hex में catalogued हैं (♥ के लिए U+2665, 😀 के लिए U+1F600)। Decimal equivalents exist करते हैं लेकिन hex form Unicode charts से match करता है।
- Bitmask arithmetic: feature flags, permission bits, hardware register values सभी decimal की बजाय binary या hex के रूप में read करना easier है।
- Assembly या disassembled code debug करना: addresses, opcodes और immediate values conventionally hex में लिखे जाते हैं।
जानने लायक अन्य Bases
- Base 36: सबसे highest base जो alphanumerics में बिना special characters के fit होता है (10 digits + 26 letters)। Short URL hashes और कुछ encoding schemes के लिए use होता है। JavaScript का
Number.toString(36)इसे directly expose करता है। - Base 58: Bitcoin और Ripple addresses में use होता है। Easily-confused characters
0(zero),O(capital O),I(capital I) औरl(lowercase L) को skip करता है ताकि addresses handwritten transcription errors के against robust हों। - Base 62: full alphanumeric (digits + lower + upper case)। URL shortener slugs में common (
example.com/abc123में «abc123»)। - Base 64: text-only channels (email, JSON, URLs) पर transport के लिए binary data को printable ASCII के रूप में encode करता है। इस tool से different scope है, यह integers की बजाय byte streams पर operate करता है।
Source-Code Prefix Conventions
अधिकांश modern languages source code में base को disambiguate करने के लिए same set of literal prefixes use करती हैं:
- Binary:
0bया0B(Python, Ruby, Java since 7, C++ since C++14, JavaScript since ES6, Rust)। Example:0b10011100। - Octal:
0oया0O(Python 3, ES6, Rust)। Older C-family languages leading zero use करती हैं (0755), जो occasionally एक footgun है यदि आप accidentally decimal को zero से pad कर दें। - Hex:
0xया0X: virtually हर programming language में universally understood। - Decimal: कोई prefix नहीं चाहिए।
अधिक Questions
Negative Numbers के बारे में क्या?
Computers negative integers को two's complement use करके represent करते हैं: सभी bits invert करें और 1 add करें। इसलिए 8-bit two's complement में, −1 11111111 (0xFF) है, −5 11111011 (0xFB) है, और −128 10000000 (0x80) है। Most significant bit sign indicate करता है। यह tool negative integers को two's-complement representation की बजाय leading minus sign के साथ display करता है, क्योंकि बाद वाला केवल fixed bit width पर sense बनाता है, और चूंकि tool arbitrary-precision BigInt use करता है, interpret करने के लिए कोई fixed width नहीं है।
Hex letters A-F क्यों use करता है?
क्योंकि base 16 को 16 distinct digit symbols चाहिए और decimal digits 0-9 केवल ten provide करते हैं। A-F (case-insensitive) 10-15 के लिए use करने का convention IBM System/360 द्वारा 1960s में popularise किया गया और industry में standardised हुआ। Earlier systems ने other glyphs के साथ experiment किया (Bendix's G-15 ने u, v, w, x, y, z use किया) लेकिन A-F जीता।
क्या यह tool fractions handle कर सकता है?
नहीं, यह integer-only है। Fractional base conversion अधिक complex है क्योंकि अधिकांश decimal fractions का binary में exact representation नहीं होता (famous 0.1 + 0.2 ≠ 0.3 floating-point problem)। Floating-point bit-level inspection के लिए, dedicated IEEE 754 visualiser सही tool है।
क्या कुछ server को भेजा जाता है?
नहीं। Conversions आपके browser में JavaScript के native BigInt arithmetic use करके run होती हैं। आपका input page नहीं छोड़ता; tool एक बार load होने के बाद offline काम करता है।