Stax
Tools

Number Base Converter

Convert numbers between binary, octal, decimal, and hexadecimal.

Binary
Base 2
Octal
Base 8
Decimal
Base 10
Hexadecimal
Base 16

ระบบตัวเลขในการประมวลผล

การใช้งานทั่วไปตามฐาน

ตารางอ้างอิงการแปลงด่วน

คอมพิวเตอร์จัดเก็บและประมวลผลทุกอย่างในรูปแบบ binary (ฐาน 2) แต่การอ่านสตริงยาวของ 1 และ 0 เป็นเรื่องที่ผิดพลาดได้ง่ายสำหรับมนุษย์ จึงใช้การแทนค่าแบบกระชับกว่า ได้แก่ octal (ฐาน 8) และ hexadecimal (ฐาน 16) ตัวเลข hex หนึ่งหลักสอดคล้องกับ binary 4 บิตพอดี ทำให้การแปลงไม่มีการสูญเสียข้อมูลและทำได้ในใจ

การจำคู่ hex-to-binary บางคู่ช่วยให้แปลงด้วยตนเองได้เร็วขึ้นมาก: 0=0000, 1=0001, 4=0100, 8=1000, A=1010, F=1111 ค่า hex ใดก็แปลงเป็น binary ได้โดยแทนที่แต่ละหลัก hex ด้วย binary 4 บิตที่สอดคล้องกัน

นักศึกษาวิทยาการคอมพิวเตอร์ใช้แบบฝึกหัดการแปลงฐานเพื่อเข้าใจ digital logic และการโปรแกรมระดับล่าง วิศวกร embedded systems แปลงระหว่าง hex และ binary เมื่ออ่าน register map ใน datasheet — registers ของ microcontroller อธิบายด้วยที่อยู่ hex แต่จัดการด้วย bitwise operations บน binary วิศวกรเครือข่ายแปลง IP address ระหว่างทศนิยมและ binary เพื่อเข้าใจ subnetting และ CIDR notation ผู้เชี่ยวชาญด้านความปลอดภัยถอดรหัส hex-encoded payloads และ shellcode ระหว่างการวิเคราะห์ malware

การแปลงฐานทั้งหมดที่เกี่ยวข้องกับ binary ขึ้นอยู่กับกำลังของ 2 การจำ 16 กำลังแรกมีประโยชน์อย่างมาก: 2^0=1, 2^1=2, 2^2=4, 2^3=8, 2^4=16, 2^5=32, 2^6=64, 2^7=128, 2^8=256, 2^9=512, 2^10=1024, 2^16=65536, 2^32=4,294,967,296 ตัวเลขเหล่านี้ปรากฏบ่อยในการประมวลผล — ขนาดหน่วยความจำ (256 MB, 1 KB = 1024 bytes) หมายเลขพอร์ต ค่าช่องสี (0–255) และ binary flags

แปลงทศนิยมเป็น binary: หารด้วย 2 ซ้ำๆ และบันทึกเศษจากล่างขึ้นบน เช่น 42 ÷ 2 = 21 เศษ 0, 21 ÷ 2 = 10 เศษ 1, 10 ÷ 2 = 5 เศษ 0, 5 ÷ 2 = 2 เศษ 1, 2 ÷ 2 = 1 เศษ 0, 1 ÷ 2 = 0 เศษ 1 → อ่านเศษจากล่างขึ้นบน: 101010 แปลง binary เป็นทศนิยม: คูณแต่ละบิตด้วยกำลัง 2 ของตำแหน่งนั้นแล้วบวกรวม สำหรับคู่ฐานอื่น ให้แปลงเป็นทศนิยมก่อน แล้วค่อยแปลงเป็นฐานเป้าหมาย

  • Binary — ชุดคำสั่ง CPU, bitmasking, flags, subnet masks ของเครือข่าย
  • Octal — สิทธิ์ไฟล์ Unix (chmod), โปรโตคอลเดิมบางรูปแบบ
  • Decimal — ตัวเลขที่มนุษย์อ่านได้, หมายเลขพอร์ต, ที่อยู่ IP
  • Hexadecimal — ที่อยู่หน่วยความจำ, รหัสสี, SHA hashes, ลำดับไบต์, ค่า UUID

คำถามที่พบบ่อย

What is a number base?
A number base (or radix) defines how many digits a numeral system uses. Decimal (base 10) uses 0–9. Binary (base 2) uses 0 and 1. Octal (base 8) uses 0–7. Hexadecimal (base 16) uses 0–9 and A–F.
Why do programmers use hexadecimal?
Hex is compact and maps neatly to binary: each hex digit represents exactly 4 binary bits (a nibble). This makes it easy to read memory addresses, color codes (#FF5733), file signatures, and bytecode without long binary strings.
How do I convert binary to decimal?
Multiply each bit by its positional value (powers of 2 from right to left) and sum the results. For example, 1010 in binary = 1×8 + 0×4 + 1×2 + 0×1 = 10 in decimal. This converter does it instantly for any base.
What is octal used for?
Octal was common in early computing and is still used in Unix/Linux file permission notation (e.g., chmod 755). Each octal digit represents exactly 3 bits, making it a compact alternative to binary.
What is the nibble grouping in binary?
Nibble grouping splits binary output into groups of 4 bits (e.g., 1010 1101 instead of 10101101). This matches hex digit boundaries, making it easier to convert mentally between binary and hexadecimal.

เครื่องมือที่เกี่ยวข้อง