진법 변환 계산기
2진·8진·16진수를 상호 변환
| 2 (binary) | 8 (octal) | 10 (decimal) | 16 (hex) |
|---|---|---|---|
진법 변환 계산기란?
진법(radix)은 숫자를 표현하는 기수 체계입니다. 일상에서 쓰는 10진법 외에 컴퓨터 분야에서 자주 쓰이는 2진법(binary)·8진법(octal)·16진법(hex)을 이 계산기로 자유롭게 상호 변환할 수 있습니다.
사용 방법
입력값과 원본 진법을 선택하고, 대상 진법을 고른 뒤 변환하기를 누릅니다. ↔ 버튼으로 원본·대상 진법을 즉시 맞바꿀 수 있으며, 결과는 2·8·10·16진법 네 가지로 동시에 표시됩니다.
공식·참고표
원본 진법 문자열을 정수로 해석(parseInt(str, from))한 뒤, 대상 진법 문자열로 다시 표현(toString(to))합니다. 16진수는 결과를 대문자로 표시합니다.
| 2진 | 8진 | 10진 | 16진 |
|---|---|---|---|
| 1010 | 12 | 10 | A |
| 11111111 | 377 | 255 | FF |
컴퓨터가 2진수를 쓰는 이유 · 16진수 색상 코드 실례
컴퓨터 회로는 전압이 있음(켜짐)과 없음(꺼짐), 딱 두 가지 상태만 안정적으로 구별합니다. 만약 10가지 전압 수준으로 10진수를 직접 표현하려 하면 잡음이나 미세한 전압 변화만으로도 다른 숫자로 잘못 읽힐 위험이 커집니다. 반면 2진수는 0과 1, 단 두 상태만 구별하면 되므로 오류 확률이 훨씬 낮아 모든 디지털 회로의 기본 표현 방식이 되었습니다.
16진수는 이 2진수를 사람이 읽기 편하게 압축한 표기입니다. 2진수 4자리(0000~1111)가 정확히 16진수 한 자리(0~F)에 대응하기 때문입니다. 웹 색상 코드가 대표적인 예로, #FF0000은 빨강·초록·파랑(RGB) 채널을 각각 16진수 두 자리로 나타낸 것입니다. 이 계산기에 255를 원본 10진법에서 16진법으로 변환하면 FF가 나오는데(255 = 15×16+15), 이는 빨강 채널이 낼 수 있는 최댓값을 의미하고, 초록·파랑이 00(=0)이므로 순수한 빨간색이 됩니다.
8진수로 표기하는 리눅스 파일 권한 chmod 755
리눅스·유닉스 파일 권한은 읽기(r=4)·쓰기(w=2)·실행(x=1) 세 비트의 합으로 표현되며, 이 합이 0~7 사이의 값이 되기 때문에 8진수로 표기합니다. chmod 755에서 첫째 자리 7은 소유자 권한으로 4+2+1(rwx, 읽기·쓰기·실행 모두 허용)이고, 둘째·셋째 자리 5는 그룹·기타 사용자 권한으로 4+1(r-x, 읽기·실행만 허용, 쓰기 제외)을 뜻합니다. 이 계산기의 원본 진법을 8, 대상 진법을 10으로 두고 755를 변환하면 493이 나오는데, 이는 세 자리 각각을 8진수 한 자리로 독립적으로 다룰 때와 결과가 다르므로, 파일 권한을 해석할 때는 755의 각 숫자를 개별 8진수 자리로 읽어야 합니다.
What is the Radix Converter?
A radix (base) is a number system's counting base. Besides everyday decimal (base 10), this tool freely converts between binary, octal, and hexadecimal, which are common in computing.
How to use it
Enter a value, choose its from base, choose a to base, then press Convert. The ↔ button instantly swaps the from/to bases, and the result is shown simultaneously in base 2, 8, 10, and 16.
Formula & reference
The source string is parsed as an integer (parseInt(str, from)) and re-expressed in the target base (toString(to)). Hexadecimal results are shown in uppercase.
| Binary | Octal | Decimal | Hex |
|---|---|---|---|
| 1010 | 12 | 10 | A |
| 11111111 | 377 | 255 | FF |
Why computers use binary · a hex color code in practice
Computer circuits can reliably distinguish only two stable states: voltage present (on) and voltage absent (off). Trying to represent 10 decimal digits directly with 10 distinct voltage levels would make even small noise or voltage drift likely to flip a digit into the wrong reading. Binary needs to distinguish only 0 and 1, so its error rate is far lower — which is why it became the base representation for all digital circuits.
Hexadecimal is a human-friendly compression of binary, since exactly 4 binary digits (0000-1111) map to one hex digit (0-F). Web color codes are a familiar example: #FF0000 expresses the red, green, and blue (RGB) channels as two hex digits each. Converting 255 from decimal to hex in this calculator gives FF (255 = 15×16+15), which represents the maximum value the red channel can hold, while green and blue are 00 (=0) — producing pure red.
Octal notation in Linux file permissions: chmod 755
Linux/Unix file permissions are expressed as the sum of three bits — read (r=4), write (w=2), execute (x=1) — which always adds up to a value between 0 and 7, so they're written in octal. In chmod 755, the first digit, 7, is the owner's permission: 4+2+1 (rwx, read, write, and execute all allowed). The second and third digits, 5, are the group and other users' permissions: 4+1 (r-x, read and execute only, no write). Converting 755 from base 8 to base 10 in this calculator gives 493, treating it as one continuous octal number — which differs from reading each digit independently as its own 3-bit permission group, so file permissions must be interpreted digit by digit.