Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Tools › Computer Science

Binary, decimal and hex converter

Convert between base 2, 8, 10 and 16, with the place-value working.

45 (decimal)

  1. 101101₍2₎ = 1×2^5 + 0×2^4 + 1×2^3 + 1×2^2 + 0×2^1 + 1×2^0
  2. Decimal: 45
  3. Binary: 101101
  4. Octal: 55
  5. Hex: 2D

How it works

Each place in binary is worth double the place to its right: 1, 2, 4, 8, 16… To convert to decimal, add the place values where there is a 1.

Hexadecimal uses 0–9 and A–F, and each hex digit stands for exactly four bits.

Worked example

With Number = 101101:

  1. 101101₍2₎ = 1×2^5 + 0×2^4 + 1×2^3 + 1×2^2 + 0×2^1 + 1×2^0
  2. Decimal: 45
  3. Binary: 101101
  4. Octal: 55
  5. Hex: 2D

Answer: 45 (decimal)

Questions

Why do computers use binary?
A circuit is easiest to build with two states, on and off, which map to 1 and 0.

Learn the method properly

The chapter behind this tool, with animations, an experiment and an AI tutor who checks each step you write.

Open the chapter

More computer science tools

  • Truth table generator
  • Password strength checker