T
THINKFORU
Submit Feedback

Hex to Binary Converter

Hex to Binary Converter

Save on Google
Tip: enter one number to see the digit-by-digit steps, decimal and octal. Several numbers (one per line), hex fractions like 2E.6 and prefixes like 0x1F also work.
Output appears here
 
Related Developer Tools
Tool NameExplanation
Binary to Hex ConverterGroups binary bits in fours and converts them into hex digits.
Octal to Binary ConverterExpands each octal digit into 3 bits with steps, decimal and hex.
Text to Hex ConverterConverts text into hexadecimal bytes with separator and prefix options.
Hex to Text ConverterDecodes hexadecimal bytes back into readable text.
Binary to Decimal ConverterConverts binary numbers into decimal with bit-by-bit steps, hex and octal.
Decimal to Binary ConverterConverts decimal numbers into binary with steps, 2's complement and hex.
Octal to Text ConverterDecodes octal bytes (110 145 154 154 157) back into readable text.
Text to Octal ConverterConverts text into octal bytes with separator, digits and prefix options.
Binary to Text ConverterDecodes binary (0s and 1s) back into readable text.
Text to Binary ConverterConverts text into 8-bit or 7-bit binary (0s and 1s) instantly.
Base64 Encode / DecodeEncodes text or files to Base64 and decodes Base64 strings instantly.
JSON to Go Struct ConverterGenerates idiomatic Go structs with json tags from any JSON payload.
JSON to TypeScript InterfaceGenerates typed TypeScript interfaces from any JSON payload.
HTML to JSX ConverterConverts HTML markup into valid React JSX (className, self-closing tags, style objects).
TOML to JSON ConverterTransforms TOML config files into clean, formatted JSON or YAML.

Example 1: Convert D7 to Binary

Hex digitBinary (4 bits)Part
D1101integer
70111integer
Join 1101 and 0111: 11010111.

Example 2: Convert 2E.6 to Binary

Hex digitBinary (4 bits)Part
20010integer
E1110integer
60110fraction
Join 0010 1110 . 0110 and drop the leading and trailing zeros: 101110.011.

Hex Digit to Binary Table (0-F)

Hex digitBinary (4-bit)Decimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115

Hex to Binary Table (00-FF)

Hex (2-digit)BinaryDecimalOctal
00000
01111
021022
031133
0410044
0510155
0611066
0711177
081000810
091001911
0A10101012
0B10111113
0C11001214
0D11011315
0E11101416
0F11111517
10100001620
11100011721
12100101822
13100111923
14101002024
15101012125
16101102226
17101112327
18110002430
19110012531
1A110102632
1B110112733
1C111002834
1D111012935
1E111103036
1F111113137
201000003240
211000013341
221000103442
231000113543
241001003644
251001013745
261001103846
271001113947
281010004050
291010014151
2A1010104252
2B1010114353
2C1011004454
2D1011014555
2E1011104656
2F1011114757
301100004860
311100014961
321100105062
331100115163
341101005264
351101015365
361101105466
371101115567
381110005670
391110015771
3A1110105872
3B1110115973
3C1111006074
3D1111016175
3E1111106276
3F1111116377
40100000064100
41100000165101
42100001066102
43100001167103
44100010068104
45100010169105
46100011070106
47100011171107
48100100072110
49100100173111
4A100101074112
4B100101175113
4C100110076114
4D100110177115
4E100111078116
4F100111179117
50101000080120
51101000181121
52101001082122
53101001183123
54101010084124
55101010185125
56101011086126
57101011187127
58101100088130
59101100189131
5A101101090132
5B101101191133
5C101110092134
5D101110193135
5E101111094136
5F101111195137
60110000096140
61110000197141
62110001098142
63110001199143
641100100100144
651100101101145
661100110102146
671100111103147
681101000104150
691101001105151
6A1101010106152
6B1101011107153
6C1101100108154
6D1101101109155
6E1101110110156
6F1101111111157
701110000112160
711110001113161
721110010114162
731110011115163
741110100116164
751110101117165
761110110118166
771110111119167
781111000120170
791111001121171
7A1111010122172
7B1111011123173
7C1111100124174
7D1111101125175
7E1111110126176
7F1111111127177
8010000000128200
8110000001129201
8210000010130202
8310000011131203
8410000100132204
8510000101133205
8610000110134206
8710000111135207
8810001000136210
8910001001137211
8A10001010138212
8B10001011139213
8C10001100140214
8D10001101141215
8E10001110142216
8F10001111143217
9010010000144220
9110010001145221
9210010010146222
9310010011147223
9410010100148224
9510010101149225
9610010110150226
9710010111151227
9810011000152230
9910011001153231
9A10011010154232
9B10011011155233
9C10011100156234
9D10011101157235
9E10011110158236
9F10011111159237
A010100000160240
A110100001161241
A210100010162242
A310100011163243
A410100100164244
A510100101165245
A610100110166246
A710100111167247
A810101000168250
A910101001169251
AA10101010170252
AB10101011171253
AC10101100172254
AD10101101173255
AE10101110174256
AF10101111175257
B010110000176260
B110110001177261
B210110010178262
B310110011179263
B410110100180264
B510110101181265
B610110110182266
B710110111183267
B810111000184270
B910111001185271
BA10111010186272
BB10111011187273
BC10111100188274
BD10111101189275
BE10111110190276
BF10111111191277
C011000000192300
C111000001193301
C211000010194302
C311000011195303
C411000100196304
C511000101197305
C611000110198306
C711000111199307
C811001000200310
C911001001201311
CA11001010202312
CB11001011203313
CC11001100204314
CD11001101205315
CE11001110206316
CF11001111207317
D011010000208320
D111010001209321
D211010010210322
D311010011211323
D411010100212324
D511010101213325
D611010110214326
D711010111215327
D811011000216330
D911011001217331
DA11011010218332
DB11011011219333
DC11011100220334
DD11011101221335
DE11011110222336
DF11011111223337
E011100000224340
E111100001225341
E211100010226342
E311100011227343
E411100100228344
E511100101229345
E611100110230346
E711100111231347
E811101000232350
E911101001233351
EA11101010234352
EB11101011235353
EC11101100236354
ED11101101237355
EE11101110238356
EF11101111239357
F011110000240360
F111110001241361
F211110010242362
F311110011243363
F411110100244364
F511110101245365
F611110110246366
F711110111247367
F811111000248370
F911111001249371
FA11111010250372
FB11111011251373
FC11111100252374
FD11111101253375
FE11111110254376
FF11111111255377

Common Hex Numbers in Binary

NumberHexBinaryDecimal
Subnet mask octet (/25)8010000000128
Subnet mask octet (/26)C011000000192
Subnet mask octet (/27)E011100000224
Subnet mask octet (/28)F011110000240
Subnet mask octet (/29)F811111000248
Subnet mask octet (/30)FC11111100252
Subnet mask octet (/31)FE11111110254
Subnet mask octet (/24)FF11111111255
SSH port161011022
SMTP port191100125
DNS port3511010153
HTTP port50101000080
HTTPS port1BB110111011443
MySQL portCEA1100111010103306
PostgreSQL port153810101001110005432
Alternate HTTP port1F9011111100100008080
Loopback first octet7F1111111127
Private IP first octet (10.x.x.x)A101010
Private IP first octet (192.168.x.x)C011000000192
Private IP second octet (192.168.x.x)A810101000168
TenA101010
One hundred641100100100
One thousand3E811111010001000
Max signed 8-bit7F1111111127
Max unsigned 8-bitFF11111111255
Values in a byte100100000000256
One kibibyte400100000000001024
Page size100010000000000004096
Max signed 16-bit7FFF11111111111111132767
Max unsigned 16-bitFFFF111111111111111165535
Values in 16 bits100001000000000000000065536
Max RGB hex FFFFFFFFFFFF11111111111111111111111116777215
Max signed 32-bit7FFFFFFF11111111111111111111111111111112147483647
Max unsigned 32-bitFFFFFFFF111111111111111111111111111111114294967295
Days from 1970 to 20002ACD1010101100110110957
ASCII letter A41100000165
ASCII letter a61110000197
ASCII digit 03011000048
ASCII space2010000032
ASCII line feedA101010

Common Hex Colors in Binary

ColorHexBinary (R G B)
Black#00000000000000 00000000 00000000
White#FFFFFF11111111 11111111 11111111
Red#FF000011111111 00000000 00000000
Green (lime)#00FF0000000000 11111111 00000000
Blue#0000FF00000000 00000000 11111111
Yellow#FFFF0011111111 11111111 00000000
Cyan#00FFFF00000000 11111111 11111111
Magenta#FF00FF11111111 00000000 11111111
Gray#80808010000000 10000000 10000000
Silver#C0C0C011000000 11000000 11000000
Orange#FFA50011111111 10100101 00000000
Navy#00008000000000 00000000 10000000
Teal#00808000000000 10000000 10000000
Maroon#80000010000000 00000000 00000000
Olive#80800010000000 10000000 00000000
Purple#80008010000000 00000000 10000000

Hex Fractions in Binary

HexBinary
0.80.1
0.40.01
0.20.001
0.10.0001
0.A0.101
0.C0.11
1.81.1
2.410.01
F.F1111.1111
2E.6101110.011
A.A1010.101
FF.FF11111111.11111111
0.0F0.00001111
0.199990.00011001100110011001

Technical Q&A / FAQ Matrix

Technical Developer QuestionExact Solution & Code Snippet
How do I convert hex to binary in JavaScript?parseInt('D7', 16).toString(2)
How do I convert hex to binary in Python?format(int('D7', 16), 'b')
How do I convert hex to binary in Go?n, _ := strconv.ParseInt("D7", 16, 64); fmt.Println(strconv.FormatInt(n, 2))
How do I convert hex to binary in Java?Integer.toBinaryString(Integer.parseInt("D7", 16))
How do I convert hex to binary in C#?Convert.ToString(Convert.ToInt32("D7", 16), 2)
How do I convert hex to binary in PHP?echo decbin(hexdec('D7'));
How do I convert hex to binary in Rust?format!("{:b}", i64::from_str_radix("D7", 16).unwrap())
How do I convert hex to binary on Linux?echo 'ibase=16; obase=2; D7' | bc
How do I convert hex to binary by hand?Replace each hex digit with its 4-bit group. D = 1101 and 7 = 0111, so D7 is 11010111.
Why does each hex digit become exactly 4 bits?Hex is base 16 and 16 = 2^4, so one hex digit holds 4 bits. Two hex digits make one byte.
What is the binary value of hex FF?11111111. Each F is 1111, so FF is 8 ones, which is 255 in decimal.
How do I convert a hex fraction to binary?Convert each digit after the point to 4 bits. 0.A in hex is 0.1010 in binary, which is 0.101 after dropping trailing zeros.
How do I read a hex color in binary?Each channel is one byte. #FF8000 is FF 80 00, which is 11111111 10000000 00000000.
Do leading zeros change the binary result?The value stays the same. The tool drops leading zeros by default, or keeps full 4-bit groups when Leading zeros is set to Keep.
Why do I get an invalid character error?Hex uses only 0-9 and A-F, in upper or lower case. Remove other letters and stray symbols. A 0x prefix, spaces and underscores are ignored.
How do I convert binary back to hex?Group the bits in fours from the right. In JavaScript: parseInt('11010111', 2).toString(16) gives d7.