Your Ad Here
String Function
Execute String Function Online
String Functions Online Tool

Conversion - String Function Blog

Archive for the ‘Conversion’ Category

 

Convert Binary and Decimal Values

Friday, January 15th, 2010

Decimal to Binary conversion is accomplished easily by determining whether the decimal number is odd or even, then successive division by 2, recording the result in binary form.


Convert Decimal to Binary

Try our Decimal to Binary Converter
As an example, the decimal number 153 is odd.

  • The rightmost binary digit – known as the Least Significant Digit or LSD – would be a “1”. If the number had been even, as 152, the LSD would be a “0”. As we record “1″ for the LSD, we now have to divide 152 (153-1)
  • Divide the remainder (152) by 2. If the result is even, record a “0” to the left of the LSD. It is in this example, leaving 76, and the binary string is now “01”.
  • 76 is evenly divided by 2, leaving 38, so record a “0”, the resulting binary string now being “001”.
  • Divide again, resulting in an odd number, 19. Record a 1, subtract the 1 from 19 and result is now “1001.”
  • Divide 18 by 2, resulting in 9. Again, it’s odd, record a 1, subtract the 1 from 9, leaving 8, the binary string is now “11001”.
  • The number 8 is evenly divisible, record a 0, resulting string is now “011001″
  • Divide 4 by 2, leaving 2, which is also even. Resulting string is now “0011001”.
  • Divide the 2 by 2, resulting in 1. Record this as the last and Most Significant Digit. The final result is the binary string “10011001” which is the representation of the decimal number 153.

Convert Binary to Decimal

Try our Binary to Decimal converter
Conversion of binary to decimal values is equally simple.

  • Start at the least significant (rightmost) digit 10011001 is odd, record a 1.
  • The next leftmost bit is the number of 2s, which is none.
  • The next is the number of 4s. Again, none.
  • The next leftmost is the number of 8s. There is one, so record an 8.
  • The next left bit is also a 1, which the number 16s. We now have recorded 1+8+16 so far.
  • The next bit is the number of 32s, none.
  • The next is the number of 64s, again none.
  • The last, most significant digit is the number of 128s. We have 1, record that.
  • Now add the decimal numbers together 1+8+16+128, resulting in the decimal number 153.

These methods are just two of several ways to accomplish the conversion. There are tables and charts which can assist in binary to decimal conversion online, as well as the opposite decimal to binary conversion. The two methods given above have the advantage of being easily done in your head without a tool, since the processes are simple addition and easy division by twos.

VN:F [1.7.0_948]
Rating: +9 (from 9 votes)

 

Convert Binary and Hexadecimal

Tuesday, January 12th, 2010

Hi guys,

Sometimes, videos make it easier to understand things. Here’s a video that explains how to convert hexadecimal to binary and how to convert binary to hexadecimal.


Enjoy!

VN:F [1.7.0_948]
Rating: +8 (from 8 votes)

 

How to Manually Convert an ASCII String to Hexadecimal or Binary

Friday, November 20th, 2009

In computer programming, computers only understand a binary numbering system – based on 2s. Currently, many programmers use a hexadecimal system, which is based on units of 16. Although there are many online tools to help with conversions, an understanding of manual ASCII to binary to hexadecimal conversions is helpful.


The first step is to understand counting in different systems. Our usual denary system uses the digits 0 – 9. Once you reach “9” you start with 10, 11, etc back to 19. Then you move on to the 20s. Binary and hexadecimal numbering systems use the same procedure, with different digits. Binary uses only the numbers 0 and 1. Usually, these are written with four digits, so 0 in denary is 0000 in binary.

Decimal Binary
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

The hexadecimal numbering systems uses the number 0 – 9 and A – F. They are represented by 2 numbers or letters: 00 – FF. The letter “A” is number 10, “B” is 11, and “F” is 15. Counting in hexadecimal looks like this: 00, 01, … 09, 0A, 0B, … 0F, 10, 11, … 1A, 1B, … 1F, 20, etc.

Decimal Hexadecimal
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F

Use this tool to convert decimal to hexadecimal. Try also the opposite tool to convert hex to decimal
Converting between binary and hexadecimal is fairly easy. A single hexadecimal number requires four binary numbers. So the binary number 0000 = hexadecimal 0, binary 0100 is hexadecimal 4, and binary 1010 is hexadecimal A.

In computer programming, you also need a way to incorporate letters. ASCII stands for American Standard Code for Information Interchange, and is based on the English alphabet. ASCII string are converted to binary or hexadecimal values, allowing words and letters to be used by computers.

The values needed to convert ASCII string to binary or hexadecimal are contained in tables. However, if you don’t have access to a table, you can manually convert ASCII to hex or binary by memorizing a few rules and applying basic counting rules. The numbers 0 – 9 begin with binary number 0011 0000, and hexadecimal number 30. Now, if you just remember the hexadecimal value (which is just 2 characters) you can convert to binary. The hexadecimal value “3” is 0011 binary, and “0” is 0000. Now you can count up through the ASCII number 9.


The capital letters A – Z begin with hexadecimal 41 and the small letters a – z begin with hexadecimal 61 and binary number 0110 0001. One more important character – a space – is hexadecimal 20 and binary 0010 0000.

Finally, here is an example with the manual conversions. To convert a string to hexadecimal, let’s take “Hi mom”, start with the “H”. “A” begins with hexadecimal value of 41, “B” is 42, …”G” is 47, and “H” is 48. Next is the letter “i”. “a” is hexadecimal 61, “b” is 62, … “h” is 68, and “i” is 69. So your first part is 48 69. Now insert the space, and the rest of the letters. Final answer: 48 69 20 6D 6F 6D

If you remember how to count, a few ASCII conversion to hex values, and a little practice, manual conversions are pretty easy.

VN:F [1.7.0_948]
Rating: +10 (from 10 votes)