Fraction Maker. Create Visual Models of fractions and save as images to desktop!


A+    A−    B  
Home
Algebra
Math Games
  • Decimals in Space
  • Fraction Balls
  • Integers in Space
  • Math Man
  • Number Balls
  • Geometry
    Interactive
    Trigonometry
    Jobs
  • Tutoring jobs
  • New York Tutoring Jobs
  • White Plains, NY
  • Westchester County, NY
  • Chicago Math Jobs
  • Philadelphia
  • Teacher Resources
    On FaceBook!

    Binary & Hexadecimal Calculator

    Calculate/convert between Binary, Hexadecimal and Decimal



    1) Type in a number in either binary, hex or decimal form



    2) Select binary, hex or decimal output then calculate the number.

    (Note: this calculator does not yet check to make sure that you have properly entered the numbers. So you have to enter valid hex or binary numbers. It will not stop you from entering 1K as a hexadecimal number even though K is not valid hex.)
    Number to convert
    Decimal input
    Hexadecimal input
    Binary input
    Output

    Decimal output
    Hexadecimal output
    Binary output


    PHP code for these calculations
    //input binary, output hex
    //uses PHP's dechex function
    function binaryToHex($binIn){
        $last = strlen($binIn)-1;
      for($i=0; $i<=$last; $i++){ $x += $binIn[$last-$i] * pow(2,$i); }
      return dechex($x);
    }
    
    Aahh yes, PHP is great and after using the function up above, I learned aobut the handy base_convert( ) function which lets you convert any number between whatever bases you'd like.
    This function takes three arguments as follows base_convert($numberYouWantToConvert,$baseOfThatNumber, $baseToConvertTo). For example, running base_convert($hexInPut, 16, 2) will convert the the hexadecimal $hexInPut from base 16 to binary. And conversely, base_convert($binIn, 2, 16) converts the binary $binIn to hexadecimal.

    Top