Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Mathematics
  • Number System and Arithmetic
  • Algebra
  • Trigonometry
  • Statistics
  • Probability
  • Geometry
  • Mensuration
  • Calculus
  • Logarithms
Open In App

Decimal to Hexadecimal Converter

Last Updated : 08 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Decimal to Hexadecimal Calculator is a free online tool prepared by GeekforGeeks that converts the given value of the decimal number into the value of the hexadecimal number. It is a fast and easy-to-use tool that helps students solve various problems.

How to use Decimal to Hexadecimal Calculator?

We can easily use the decimal to hexadecimal converter by following the steps discussed below,

Step 1: Enter the given value in the decimal input field.

Step 2: Click on the convert button to convert the decimal value into the hexadecimal value.

Step 3: The value shown as the result is the required value in the hexadecimal form.

What is Decimal to Hexadecimal Conversion?

Decimal to hexadecimal conversion is the process of converting a decimal number to a hexadecimal number. The decimal numeral system has a base value of 10 (0 to 9) and the hexadecimal has a base value of 16 (0 to 9 and A to F for 10-15). 

There are different ways to convert Decimal to Hex numbers. They are as follows:

Converting Numbers with the Integer part

Step 1: Take the decimal number as dividend and 16 as the divisor (hexadecimal number will have 16 as a base)

Step 2: Divide the dividend with the divisor and store the remainder in an array

Step 3: Now divide the quotient obtained from the above step by 16 and store the remainder in the array.

Step 4: Repeat the third step until the number is greater than zero.

Step 5: The final hexadecimal value will be the reverse order of the array.

Example 1: Let’s consider a decimal number 450. We need to convert this decimal number to a hexadecimal number.

Solution:

Given: Decimal number = 450(10)

Step 1: 450/16 gives Q1 = 28 and R1 = 2

Step 2: 28/16 gives Q2 = 1 and R2 = 12 = C

Step 3: 1/16 gives Q3 =  0 and R3 = 1

Step 4: 0/16 gives Q4 =  0 and R4 = 0

Therefore, the hexadecimal value is 01C2(16)

Converting Numbers with Fractional Parts

Step 1: Take the decimal fractional number and multiply it with 16 (hexadecimal number will have 16 as a base)

Step 2: Store the remainder in an array i.e. the integer part

Step 3: Repeat the above two steps until the number is zero.

Step 4: The final hexadecimal value will be the elements of the array.

Example 1: Convert 0.0645(10) to _______(16)  

Solution: 

Given: Decimal number = 0.0645(10)

Step 1: 0.0645 x 16 = 1.032 and R1 = 1

Step 2: 0.032 x 16 = 0.512 and R2 = 0  

Step 3: 0.512 x 16 = 8.192 and R3 = 8

Step 4: 0.192 x 16 = 3.072 and R3 = 3

Step 5: 0.072 x 16 = 1.152 and R3 = 1

The fractional part is still not zero so it continues, now we can take up to 5 remainders

Therefore, the hexadecimal value is 0.10831...(16)

Converting Numbers with Both Integer and Fractional parts

Steps of both the integer part and fractional part are to be followed.

Example 1: Convert 256.00390625(10) to _________(16)  

Solution:

 Given: Decimal number = 256.00390625(10) 

Let's perform the conversion on integer part:

Integer value = 256(10)

Step 1: 256/16 gives Q1 = 16 and R1 = 0

Step 2: 16/16 gives Q2 = 1 and R2 = 0

Step 3: 1/16 gives Q3 =  0 and R3 = 1

Let's perform the conversion on fractional part:

Fractional value = 0.00390625(10)

Step 1: 0.00390625 x 16 = 0.0625 and R1 = 0

Step 2: 0.0625 x 16 = 1.0 and R2 = 1 

Step 3: 0.0 x 16 = 0 and R3 = 0

Therefore, the hexadecimal value is 100.010(16)

Indirect Conversion

In this type of conversion, we will convert the decimal number to a binary number or octal number and further convert it to a hexadecimal number by grouping digits.

Example 1: Convert 66(10) to _______(16)  

Solution:

Given: Decimal Number =  345(10)

Convert the given decimal number to its binary form:

Convert 66 into hexadecimal by indirect method

Binary Number = 1000010(2)

Now, Group 4 binary digits as one group and write its hexadecimal value

i.e. 0100 0010

Therefore, Hexadecimal Number =  42(16)

Convert Decimal to Hexadecimal

Converting decimal to hexadecimal is simple using a conversion table. Memorize the table for easy conversion of numbers 1 to 15. To convert larger numbers, divide by 16 and use the remainder as the hexadecimal digit. Check the table for values 0 to 15 for reference.

Decimal to Hexadecimal Table

The following table shows the representation of Hexadecimal, decimal and binary values:

Decimal DigitHexadecimal DigitBinary Form
          0             0      0000
          1             1     0001
          2             2     0010
          3             3     0011
          4             4     0100
          5             5     0101
          6             6     0110
          7             7     0111
          8             8     1000
          9             9     1001
         10             A     1010
         11             B     1011
         12             C     1100
         13             D     1101
         14             E     1110
         15             F     1111

Also Check:

  • Decimal To Binary
  • Number System and Base Conversions
  • Convert Decimal to Octal

Decimal to Hexadecimal Conversion Solved Examples

Example 1: Convert 20 in decimal to hexadecimal

Solution:

We know that to convert a number from decimal to hexadecimal we need to divide the number by 16 and then successively divide the quotient by 16 until quotient is zero

20 ÷ 16 gives Q1 = 1, R1 = 4

1 ÷ 16 gives Q2 = 0, R2 = 1

Hence, 20 in decimal is equal to 14 in hexadecimal

Example 2: Convert (678)10 to Hexadecimal

Solution:

678 ÷ 16 gives Q1 = 42, R1 = 6

42 ÷ 16 gives Q2 = 2, R2 = 10 = A

2 ÷ 16 gives Q3 = 0, R3 = 2

Hence, (678)10 = 2A6 in Hexadecimal

Example 3: Convert (1429)10 into Hexadecimal

Solution:

1429 ÷ 16 gives Q1 = 89 and R1 = 5

89 ÷ 16 gives Q2 = 5 and R2 = 9

5 ÷ 16 gives Q3 = 0 and R3 = 5

Hence (1429)10 = 595 in Hexadecimal

Example 4: Convert 0.125 in Hexadcimal

Solution:

To convert a fractional number we multiply the fractional part by 16 and then again multiply the fractional part of the product by 16 till the number becomes zero and then write the result from the first product and not from the last as we do normally.

0.125 ⨯ 16 = 2.0

0 ⨯ 16 = 0

Hence, (.125)10 = 0.2

Practice Questions on Decimal to Hexadecimal Conversion

Q1: 234

Q2: 4573

Q3: 0.1345

Q4: 675434

Q5: 567


S

sharanyatriveni
Improve
Article Tags :
  • Utilities
  • Math-Concepts

Similar Reads

    Maths Calculators
    GeeksforGeeks's free online math calculator is a one-stop solution for all your complex and tough mathematical problems. It is a math solver tool that will save you a lot of time while doing complex calculations. GeeksforGeeks Calculator is a key to solving challenging math equations and tasks, maki
    3 min read
    CM to Inches Converter
    Centimeter-to-inch conversion is a simple yet essential calculation used in various fields, including construction, design, and everyday measurements. Here is a handy conversion tool for converting centimeters (cm) to inches, helping you make accurate measurements effortlessly:Centimeters to Inches
    4 min read
    Inches to Centimeters Converter - Inches to Cm
    Inches to cm converter is a free online tool that calculates value in centimeters after taking Inches value in Input. GeeksforGeeks Inches to cm converter is the fastest online tool to convert Inches to Centimeters. Use the tool below to save your time on calculations and get accurate and fast resul
    4 min read
    Feet to Centimeters Converter (feet to cm Converter)
    Feet to Centimeter Calculator Converter is a free online tool that is used to convert the measurement in feet to centimeters and vice versa. The ft to cm converter calculator prepared at geeksforgeeks given below easily calculates the length in feet to length in centimeters.Table of Content Feet to
    6 min read
    cm to mm Converter
    Centimeter(cm) to Millimeter(mm) Converter is a free online tool to convert cm to mm. Converting between cm to mm is a common task in everyday life. So, GeeksforGeeks provides a user-friendly and efficient cm to mm Conversion tool to simplify this process and assure accuracy. It is an easy-to-use ge
    5 min read
    Millimeter to Inches (mm to inch) Converter
    Millimeter to Inches (mm to inch) Converter is a free online tool to convert mm to inch. Converting between mm to inch is a common task in everyday life. So, GeeksforGeeks provides a user-friendly and efficient mm-to-inch calculator tool to simplify this process and assure accuracy. It is an easy-to
    5 min read
    Millimeter to Centimeter Converter
    Millimeter to centimeter calculator is a free online tool to convert Millimeter to Centimeter. This geeksforgeeks online Millimeter to centimeter converter makes the calculation faster and it displays the conversion in a fraction of seconds. It is an easy-to-use general purpose calculator that makes
    4 min read
    MM to Feet Converter (Millimeter to Feet)
    1 Feet is equal to 0.0033 feet. To make the conversion of MM to Feet easy, below is the MM to Feet online converter tool. It is a fast, easy-to-use general-purpose calculator that can be used in any field, such as engineering, etc. Furthermore, It also helps students and working professionals to sol
    5 min read
    Meters to Feet (m to ft) Converter
    Meter to Feet Calculator is a free tool prepared by GeekforGeeks that converts the given value of the meter(m) into the value of feet(ft). It is a fast and easy-to-use tool that helps students solve various problems.Table of ContentDefinition of Meter and FootSteps to Use the Meter to Feet Calculato
    4 min read
    Metric Tons to Kilograms Converter
    The Metric Tons to Kilograms Converter is a free online tool to convert Metric Tons to Kilograms. Converting between Metric Tons to kilograms is a common task in everyday life. So, GeeksforGeeks provides a user-friendly and efficient online Metric Tons to kg Conversion tool to simplify this process
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences