Decimal to Hex Converter

Use our Decimal to Hex Converter to turn base 10 numbers into base 16 values instantly. Learn the manual method, formulas, examples, tables, programming uses, and common mistakes.
From
Text—
Binary—
Hexadecimal—
Decimal—
Octal—
ASCII Codes—
Recent
Nothing here yetYour recent activity will appear here

What Is the Decimal Number System?

The decimal number system uses ten digits, 0 to 9, and has base 10. Each digit has a place value based on powers of 10. We use it for everyday counting, prices, scores, measurements, and calculations in school and daily life every day.

What Is Hexadecimal?

Hexadecimal is a base 16 number system. It uses 0 to 9 and A to F, where A means 10 and F means 15. Computers use hex to write binary data in a shorter, easier form for code, memory values, and digital data used by programs.

Decimal to Hex Converter showing decimal numbers converted from base 10 to hexadecimal values.

How can you use our Decimal to Hex Converter?

Our Decimal to Hex Converter quickly converts decimal numbers into hexadecimal values.

Step 1

Enter Your Decimal Number

Type or paste the decimal number you want to convert.

Step 2

View Hex Result

Get the hexadecimal value instantly from your decimal number.

Step 3

Copy Result

Copy the converted hex value for future use.

How to Convert Decimal to Hex Manually

Decimal to hex uses repeated division by 16. The remainder becomes a hex digit. Use A to F for remainders 10 to 15.

Formula: n=16q+rn = 16q + r

Step by step Guide:

  1. Divide the decimal number by 16.
  2. Record the remainder.
  3. Divide the quotient by 16.
  4. Repeat until the quotient is 0.
  5. Read remainders from bottom to top.

Practical Example: Convert 45 to hex. 45÷16=245 \div 16 = 2 remainder 1313. Then 2÷16=02 \div 16 = 0 remainder 2. Remainder 13 becomes D. Read 2 and D, so 4510=2D1645_{10} = 2D_{16}.

Methods for Converting Decimal to Hex

You can convert decimal to hex with long division or a lookup table. Long division shows each quotient and remainder. A lookup table works best for frequent values.

Formula: n=16q+rn = 16q + r

Long Division Method

Divide the decimal number by 16. Keep each remainder, then divide the quotient again. Continue until the quotient is 0. Convert remainders 10 to 15 into A to F, then read upward.

Lookup Table Method

Find the decimal number in a conversion table and read its matching hex value. This saves time for 10 = A, 16 = 10, and 255 = FF.

Decimal to Hex conversion table

Decimal

Hex

Decimal

Hex

Decimal

Hex

Decimal

Hex

0

0

64

40

128

80

192

C0

1

1

65

41

129

81

193

C1

2

2

66

42

130

82

194

C2

3

3

67

43

131

83

195

C3

4

4

68

44

132

84

196

C4

5

5

69

45

133

85

197

C5

6

6

70

46

134

86

198

C6

7

7

71

47

135

87

199

C7

8

8

72

48

136

88

200

C8

9

9

73

49

137

89

201

C9

10

A

74

4A

138

8A

202

CA

11

B

75

4B

139

8B

203

CB

12

C

76

4C

140

8C

204

CC

13

D

77

4D

141

8D

205

CD

14

E

78

4E

142

8E

206

CE

15

F

79

4F

143

8F

207

CF

16

10

80

50

144

90

208

D0

17

11

81

51

145

91

209

D1

18

12

82

52

146

92

210

D2

19

13

83

53

147

93

211

D3

20

14

84

54

148

94

212

D4

21

15

85

55

149

95

213

D5

22

16

86

56

150

96

214

D6

23

17

87

57

151

97

215

D7

24

18

88

58

152

98

216

D8

25

19

89

59

153

99

217

D9

26

1A

90

5A

154

9A

218

DA

27

1B

91

5B

155

9B

219

DB

28

1C

92

5C

156

9C

220

DC

29

1D

93

5D

157

9D

221

DD

30

1E

94

5E

158

9E

222

DE

31

1F

95

5F

159

9F

223

DF

32

20

96

60

160

A0

224

E0

33

21

97

61

161

A1

225

E1

34

22

98

62

162

A2

226

E2

35

23

99

63

163

A3

227

E3

36

24

100

64

164

A4

228

E4

37

25

101

65

165

A5

229

E5

38

26

102

66

166

A6

230

E6

39

27

103

67

167

A7

231

E7

40

28

104

68

168

A8

232

E8

41

29

105

69

169

A9

233

E9

42

2A

106

6A

170

AA

234

EA

43

2B

107

6B

171

AB

235

EB

44

2C

108

6C

172

AC

236

EC

45

2D

109

6D

173

AD

237

ED

46

2E

110

6E

174

AE

238

EE

47

2F

111

6F

175

AF

239

EF

48

30

112

70

176

B0

240

F0

49

31

113

71

177

B1

241

F1

50

32

114

72

178

B2

242

F2

51

33

115

73

179

B3

243

F3

52

34

116

74

180

B4

244

F4

53

35

117

75

181

B5

245

F5

54

36

118

76

182

B6

246

F6

55

37

119

77

183

B7

247

F7

56

38

120

78

184

B8

248

F8

57

39

121

79

185

B9

249

F9

58

3A

122

7A

186

BA

250

FA

59

3B

123

7B

187

BB

251

FB

60

3C

124

7C

188

BC

252

FC

61

3D

125

7D

189

BD

253

FD

62

3E

126

7E

190

BE

254

FE

63

3F

127

7F

191

BF

255

FF

Note: Hex uses 0 to 9 and A to F. Each hex digit represents four binary bits, so 00 to FF covers byte values from 0 to 255. Leading zeros can keep fixed widths.

Decimal to Hex Conversion in Programming

Programmers often use hexadecimal to display binary data in a shorter form. Python and C both provide simple ways to convert decimal integers into hexadecimal.

Decimal to Hex in Python

Python provides the hex() function for decimal to hexadecimal conversion.


number = 45
result = hex(number)

print(result)

Output:


0x2d

If you want uppercase hex without the 0x prefix, use:


number = 45
result = format(number, "X")

print(result)

Output:


2D

Decimal to Hex in C

C can convert a decimal integer to hexadecimal with printf() and the %X format specifier.


#include <stdio.h>

int main() {
int number = 45;

printf("%X", number);

return 0;
}

Output:


2D

Use %x when you want lowercase hexadecimal, such as 2d.

Common mistakes of Decimal to Hex Conversion

Common mistakes include reading remainders in the wrong order, treating A to F as decimal digits, or forgetting base 16. Students may also miss leading zeros or misuse negative values. Check your answer with powers of 16, and confirm the final value by converting it back to decimal.

Frequently Asked Questions

These answers cover hexadecimal digits, base 16, conversion tools, reverse conversion, byte padding, zero, and negative values.