In mathematics and computer science, hexadecimal (also base-16 , hexa , or hex ) is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0 9 to represent values zero to nine, and A , B , C , D , E , F (or a through f ) to represent values ten to fifteen.

Its primary use is as a human-friendly representation of binary coded values, so it is often used in digital electronics and computer engineering. Since each hexadecimal digit represents four binary digits (bits) — also called a nibble — it is a compact and easily translated shorthand to express values in base two.


Uses

In digital computing, hexadecimal is primarily used to represent bytes. Attempts to represent the 256 possible byte values by other means have led to problems. Directly representing each possible byte value with a single character representation runs into unprintable control characters in the ASCII character set. Even if a standard set of printable characters were devised for every byte value, neither users nor input hardware are equipped to handle 256 unique characters. Most hex editing software displays each byte as a single character, but unprintable characters are usually substituted with a period or blank.

Representing hexadecimal

In situations where there is no context, a hexadecimal number might be ambiguous and confused with numbers expressed in other bases. There are several conventions for unambiguously expressing values. In mathematics, a subscript (itself written in decimal) is often used on each number explicitly giving the base: 159 10 is decimal 159; 159 16 is hexadecimal 159 which is equal to 345 10 . Some authors prefer a text subscript, such as 159 decimal and 159 hex .

In linear text systems, such as those used in most computer programming environments, a variety of methods have arisen:

  • In URLs, character codes are written as hexadecimal pairs prefixed with % : http://www.example.com/name%20with%20spaces where %20 is the space (blank) character (code value 20 in hex, 32 in decimal).
  • In XML and XHTML, characters can be expressed as hexadecimal character entities using the notation &#x code ; , where code is the 4- or 5-character hex number assigned to the character in the Unicode standard. Thus ’ represents the curled right single quote (Unicode value 2019 in hex, 8217 in decimal).
  • Color references in HTML and CSS can be expressed with six hexdigits (two each for the red, green, and blue components, in that order) prefixed with # : white, for example, is represented #FFFFFF . CSS allows 3-hexdigit abbreviations with one hexdigit per component: #FA3 abbreviates #FFAA33 (a golden orange).
  • *nix (UNIX and related) shells, and likewise the C programming language, which was designed for UNIX (and the syntactical descendants of C) use the prefix 0x for numeric constants represented in hex: 0x5A3 . Character and string constants may express character codes in hexadecimal with the prefix \x followed by two hex digits: '\x1B' represents the Esc control character; "\x1B Verbal and digital representations

    Not only are there no digits to represent the quantities from ten to fifteen—so letters are used as a substitute—but most Western European languages also lack a nomenclature to name hexadecimal numbers. "Thirteen" and "fourteen" are decimal-based, and even though English has names for several non-decimal powers: pair for the first binary power; score for the first vigesimal power; dozen , gross , and great gross for the first three duodecimal powers. However, no English name describes the hexadecimal powers (corresponding to the decimal values 16, 256, 4096, 65536, ...). Some people read hexadecimal numbers digit by digit like a phone number: 4DA is "four-dee-eh". However, the letter 'A' sounds similar to eight, 'C' sounds similar to three, and 'D' can easily be mistaken for the 'ty' suffix: Is it 4D or forty? Other people avoid confusion by using the NATO phonetic alphabet: 4DA is "four-delta-alfa". Similarly, some use the Joint Army/Navy Phonetic Alphabet ("four-dog-able"), or a similar ad hoc system.

    Systems of counting on (digits) have been devised for both binary and hexadecimal. Arthur C. Clarke suggested using each finger as an on/off bit, allowing finger counting from zero to 1023 on ten fingers. Another system for counting up to FF (255) is illustrated on the right; it seems to be an extension of an existing system for counting in twelves (dozens and grosses), that is common in South Asia and elsewhere.

    Signs

    The hexadecimal system can express negative numbers the same way as in decimal: –2A to represent –42 and so on.

    However, some prefer instead to express the exact bit patterns used in the processor and consider hexadecimal values best handled as signed values. This way, the negative number –42 can be written as FFFF FFD6 in a 32-bit CPU register, as C228 0000 in a 32-bit FPU register or C045 0000 0000 0000 in a 64-bit FPU register (assuming certain representation schemes, twos-complement in the 32-bit non-FPU instance and sign-magnitude in the FPU instances.)

    Real numbers

    As with other numeral systems, the hexadecimal system can be used to represent rational numbers, although recurring digits are common since sixteen (10h) has only a single prime factor (two):

    For any base, 0.1 (or "1/10") is always equivalent to one divided by the representation of that base value in its own number system: Counting in base 3 is 0, 1, 2, 10 (three). Thus, whether dividing one by two for binary or dividing one by sixteen for hexadecimal, both of these fractions are written as 0.1 . Because the radix 16 is a perfect square (4²), fractions expressed in hexadecimal have an odd period much more often than decimal ones, and there are no cyclic numbers (other than trivial single digits). Recurring digits are exhibited when the denominator in lowest terms has a prime factor not found in the radix; thus, when using hexadecimal notation, all fractions with denominators that are not a power of two result in an infinite string of recurring digits (such as thirds and fifths). This makes hexadecimal (and binary) less convenient than decimal for representing rational numbers since a larger proportion lie outside its range of finite representation.

    All rational numbers finitely representable in hexadecimal are also finitely representable in decimal, duodecimal and sexagesimal: that is, any hexadecimal number with a finite number of digits has a finite number of digits when expressed in those other bases. Conversely, only a fraction of those finitely representable in the latter bases are finitely representable in hexadecimal: That is, decimal 0.1 corresponds to the infinite recurring representation 0.199999999999... in hexadecimal. However, hexadecimal is more efficient than bases 12 and 60 for representing fractions with powers of two in the denominator (e.g., decimal one sixteenth is 0.1 in hexadecimal, 0.09 in duodecimal, 0;3,45 in sexagesimal and 0.0625 in decimal).

    Powers

    Possibly the most widely used powers, powers of two, are easier to show using the 16th base. The first sixteen powers of two are shown below.

    Since four squared is sixteen, powers of four have an even easier relation:

    This also makes tetration‎ easier when using two and four since 3 2 = 10 hex , 4 2 = 10000 hex and 5 2 = 10000000000 hex .

    Binary conversion

    Most computers manipulate binary data, but it is difficult for humans to work with the large number of digits for even a relatively small binary number. Although most humans are familiar with the base 10 system, it is much easier to map binary to hexadecimal than to decimal because each hexadecimal digit maps to a whole number of bits (4 10 ). This example converts 1111 2 to base ten. Since each position in a binary numeral can contain either a 1 or 0, its value may be easily determined by its position from the right:

    • 0001 2 = 1 10
    • 0010 2 = 2 10
    • 0100 2 = 4 10
    • 1000 2 = 8 10

    Therefore:

    With surprisingly little practice, mapping 1111 2 to F 16 in one step becomes easy: see table in Uses. The advantage of using hexadecimal rather than decimal increases rapidly with the size of the number. When the number becomes large, conversion to decimal is very tedious. However, when mapping to hexadecimal, it is trivial to regard the binary string as 4-digit groups and map each to a single hexadecimal digit.

    This example shows the conversion of a binary number to decimal, mapping each digit to the decimal value, and adding the results.

    Compare this to the conversion to hexadecimal, where each group of four digits can be considered independently, and conver

    DECIMAL BINARY HEX CONVERTER

    game - design - multimedia - web - programming - tutorials - There are currently viewers visiting Apron Tutorials.

    ...

    HEXADECIMAL to BINARY conversion, HEX to Decimal converter, Hexdecimal ...

    Here you can convert hexadecimal to binary and decimal code values. This tool helps to dynamically calculate and convert the values. Related Topics

    ...

    Binary-Octal-Decimal-Hexadecimal Converter

    Bin-Oct-Dec-Hex Converter

    ...

    Hex Binary Decimal Octal Converter with Scientific Calculator

    Hex Binary Decimal Octal Converter with Scientific Calculator Powerful and flexible multipurpose Scientific calculator and Hex/Binary/Decimal/Octal Cconversions.

    ...

    Binary/Decimal/Hexadecimal Converter

    Math explained in easy language, plus puzzles, games, quizzes, worksheets and a forum. For K-12 kids, teachers and parents.

    ...

    Decimal <--> HEX Converter

    Convert decimal to HEX Red component Green component Blue component. Convert HEX to decimal HEX value

    ...

    Binary to decimal conversion, Binary Hex converter, converting binary ...

    Here you can convert binary to hexadecimal and decimal code values. This tool helps to dynamically calculate and convert the values. Related Topics

    ...

    hexadecimal conversion, convert decimal to hexadecimal

    Decimal: Hex: Decimal: Hex: Decimal: Hex: 1: 1: 11: B: 30: 1E: 2: 2: 12: C: 40: 28: 3: 3: 13: D: 50: 32: 4: 4: 14: E: 60: 3C: 5: 5: 15: F: 70: 46: 6: 6: 16: 10: 80: 50: 7: 7: 17: 11: 90: 5A: 8: 8: 18: 12: 100: 64: 9: 9: 19: 13: 500: 1F4: 10: A: 20: 14: 1000: 3E8

    ...

    Decimal, Binary, Octal and Hex Converter

    More information: I tried to make it more user friendly as much as i can. If you find any problem or suggestion about any of my program you can mail to me at any time. my id is ...

    ...

    Download Hex to Decimal Converter 1.0 - Convert numbers from Decimal ...

    Hex to Decimal Converter Convert numbers from Decimal to Hex or Hex to Decimal at the click of a button

    ...