Overview
In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

and computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

In mathematical numeral systems, the base or radix for the simplest case is the number of unique digits, including zero, that a positional numeral system uses to represent numbers. For example, for the decimal system the radix is ten, because it uses the ten digits from 0 through 9.In any numeral...

, or hex) is a positional
Positional notation
Positional notation or place-value notation is a method of representing or encoding numbers. Positional notation is distinguished from other notations for its use of the same symbol for the different orders of magnitude...

numeral system
Numeral system
A numeral system is a writing system for expressing numbers, that is a mathematical notation for representing numbers of a given set, using graphemes or symbols in a consistent manner....

In mathematical numeral systems, the base or radix for the simplest case is the number of unique digits, including zero, that a positional numeral system uses to represent numbers. For example, for the decimal system the radix is ten, because it uses the ten digits from 0 through 9.In any numeral...

, or base, of 16. It uses sixteen distinct symbols, most often the symbols 09 to represent values zero to nine, and A, B, C, D, E, F (or alternatively af) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160), or 10,995.

Each hexadecimal digit represents four binary digits (bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

s) (also called a "nibble
Nibble
In computing, a nibble is a four-bit aggregation, or half an octet...

"), and the primary use of hexadecimal notation is as a human-friendly representation of binary-coded
Binary code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's two-binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction...

values in computing and digital electronics.
Discussion

Recent Discussions
Encyclopedia
In mathematics
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...

and computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

In mathematical numeral systems, the base or radix for the simplest case is the number of unique digits, including zero, that a positional numeral system uses to represent numbers. For example, for the decimal system the radix is ten, because it uses the ten digits from 0 through 9.In any numeral...

, or hex) is a positional
Positional notation
Positional notation or place-value notation is a method of representing or encoding numbers. Positional notation is distinguished from other notations for its use of the same symbol for the different orders of magnitude...

numeral system
Numeral system
A numeral system is a writing system for expressing numbers, that is a mathematical notation for representing numbers of a given set, using graphemes or symbols in a consistent manner....

In mathematical numeral systems, the base or radix for the simplest case is the number of unique digits, including zero, that a positional numeral system uses to represent numbers. For example, for the decimal system the radix is ten, because it uses the ten digits from 0 through 9.In any numeral...

, or base, of 16. It uses sixteen distinct symbols, most often the symbols 09 to represent values zero to nine, and A, B, C, D, E, F (or alternatively af) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to (2 × 163) + (10 × 162) + (15 × 161) + (3 × 160), or 10,995.

Each hexadecimal digit represents four binary digits (bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

s) (also called a "nibble
Nibble
In computing, a nibble is a four-bit aggregation, or half an octet...

"), and the primary use of hexadecimal notation is as a human-friendly representation of binary-coded
Binary code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's two-binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction...

values in computing and digital electronics. For example, byte
Byte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...

values can range from 0 to 255 (decimal) but may be more conveniently represented as two hexadecimal digits in the range 00 through FF. Hexadecimal is also commonly used to represent computer memory address
A digital computer's memory, more specifically main memory, consists of many memory locations, each having a memory address, a number, analogous to a street address, at which computer programs store and retrieve, machine code or data. Most application programs do not directly read and write to...

es.

In situations where there is no context, hexadecimal numbers can be ambiguous and confused with numbers expressed in other bases. There are several conventions for expressing values unambiguously. A numerical subscript (itself written in decimal) can give the base explicitly: 15910 is decimal 159; 15916 is hexadecimal 159, which is equal to 34510. Other authors prefer a text subscript, such as 159decimal and 159hex, or 159d and 159h.

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
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

and XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

, characters can be expressed as hexadecimal numeric character references using the notation `&#xcode;`, where code is the 1- to 6-digit hex number assigned to the character in the Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

standard. Thus `&#x2019;` represents the curled right single quote (Unicode value 2019 in hex, 8217 in decimal).
• Color references in HTML and CSS
Cascading Style Sheets is a style sheet language used to describe the presentation semantics of a document written in a markup language...

and X Window
X Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...

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
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

, which was designed for Unix (and the syntactic 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
Escape character
In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters...

control character; `"\x1B[0m\x1B[25;1H"` is a string containing 11 characters (plus a trailing NUL to mark the end of the string) with two embedded Esc characters. To output an integer as hexadecimal with the printf
Printf
Printf format string refers to a control parameter used by a class of functions typically associated with some types of programming languages. The format string specifies a method for rendering an arbitrary number of varied data type parameter into a string...

function family, the format conversion code `%X` or `%x` is used.
• In the Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

standard, a character value is represented with `U+ followed by the hex value: U+20AC is the Euro signEuro signThe euro sign is the currency sign used for the euro, the official currency of the Eurozone in the European Union . The design was presented to the public by the European Commission on 12 December 1996. The international three-letter code for the euro is EUR... (€).`
• ``` In MIMEMIMEMultipurpose Internet Mail Extensions is an Internet standard that extends the format of email to support:* Text in character sets other than ASCII* Non-text attachments* Message bodies with multiple parts... (e-mail extensions) quoted-printableQuoted-printableQuoted-printable, or QP encoding, is an encoding using printable ASCII characters to transmit 8-bit data over a 7-bit data path or, generally, over a medium which is not 8-bit clean... encoding, characters that cannot be represented as literal ASCIIASCIIThe American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text... characters are represented by their codes as two hexadecimal digits (in ASCII) prefixed by an equal to sign =, as in Espa=F1a to send "España" (Spain). (Hexadecimal F1, equal to decimal 241, is the code number for the lower case n with tilde in the ISO/IEC 8859-1 character set.) In Intel-derived assembly languageAssembly languageAn assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...s, hexadecimal is denoted with a suffixed H or h: FFh or 05A3H. Some implementations require a leading zero when the first hexadecimal digit character is not a decimal digit: 0FFh Other assembly languages (6502MOS Technology 6502The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of..., AT&TAT&TAT&T Inc. is an American multinational telecommunications corporation headquartered in Whitacre Tower, Dallas, Texas, United States. It is the largest provider of mobile telephony and fixed telephony in the United States, and is also a provider of broadband and subscription television services..., MotorolaMotorolaMotorola, Inc. was an American multinational telecommunications company based in Schaumburg, Illinois, which was eventually divided into two independent public companies, Motorola Mobility and Motorola Solutions on January 4, 2011, after losing \$4.3 billion from 2007 to 2009...), PascalPascal (programming language)Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal..., DelphiObject PascalObject Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:..., some versions of BASICBASICBASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code.... (CommodoreCommodore BASICCommodore BASIC, also known as PET BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET of 1977 to the C128 of 1985...) and Forth use \$ as a prefix: \$5A3. Some assembly languages (Microchip) use the notation H'ABCD' (for ABCD16). AdaAda (programming language)Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages... and VHDL enclose hexadecimal numerals in based "numeric quotes": 16#5A3#. For bit vector constants VHDL uses the notation x"5A3". VerilogVerilogIn the semiconductor and electronic design industry, Verilog is a hardware description language used to model electronic systems. Verilog HDL, not to be confused with VHDL , is most commonly used in the design, verification, and implementation of digital logic chips at the register-transfer level... represents hexadecimal constants in the form 8'hFF, where 8 is the number of bits in the value and FF is the hexadecimal constant. Modula-2Modula-2Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith... and some other languages use # as a prefix: #05A3 The SmalltalkSmalltalkSmalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist... language uses the prefix 16r: 16r5A3 PostScriptPostScriptPostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging... denotes hex with prefix 16#: 16#5A3. Binary data (such as image pixelPixelIn digital imaging, a pixel, or pel, is a single point in a raster image, or the smallest addressable screen element in a display device; it is the smallest unit of picture that can be represented or controlled....s) can be expressed as unprefixed consecutive hexadecimal pairs: AA213FD51B3801043FBC... In early systems when a MacintoshMacintoshThe Macintosh , or Mac, is a series of several lines of personal computers designed, developed, and marketed by Apple Inc. The first Macintosh was introduced by Apple's then-chairman Steve Jobs on January 24, 1984; it was the first commercially successful personal computer to feature a mouse and a... crashed, one or two lines of hexadecimal code would be displayed under the Sad Mac to tell the user what went wrong. Common LispCommon LispCommon Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in ANSI standard document ANSI INCITS 226-1994 , . From the ANSI Common Lisp standard the Common Lisp HyperSpec has been derived for use with web browsers... use the prefixes #x and #16r. MSX BASICMSX BASICMSX BASIC is a dialect of the BASIC programming language. It is an extended version of Microsoft Standard BASIC Version 4.5, and includes support for graphic, music, and various peripherals attached to MSX Personal Computers. Generally, MSX-BASIC is designed to follow GW-BASIC, which is one of the..., QuickBASICQuickBASICMicrosoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was a short-lived version for Mac OS..., FreeBASICFreeBASICFreeBASIC is a free/open source , 32-bit BASIC compiler for Microsoft Windows, protected-mode DOS , Linux, FreeBSD and Xbox.... and Visual BasicVisual BasicVisual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model... prefix hexadecimal numbers with &H: &H5A3 BBC BASICBBC BASICBBC BASIC is a programming language, developed in 1981 as a native programming language for the MOS Technology 6502 based Acorn BBC Micro home/personal computer, mainly by Sophie Wilson. It is a version of the BASIC programming language adapted for a U.K... and Locomotive BASICLocomotive BASICLocomotive Basic is a proprietary dialect of the BASIC programming language written by Locomotive Software used only on the Amstrad CPC... use & for hex. TI-89 and 92 series uses a 0h prefix: 0h5A3 The most common format for hexadecimal on IBM mainframes (zSeriesZSeriesIBM System z, or earlier IBM eServer zSeries, is a brand name designated by IBM to all its mainframe computers.In 2000, IBM rebranded the existing System/390 to IBM eServer zSeries with the e depicted in IBM's red trademarked symbol, but because no specific machine names were changed for...) and midrange computers (IBM System iIBM System iThe IBM System i is IBM's previous generation of midrange computer systems for IBM i users, and was subsequently replaced by the IBM Power Systems in April 2008....) running the traditional OS's (zOSZ/OSz/OS is a 64-bit operating system for mainframe computers, produced by IBM. It derives from and is the successor to OS/390, which in turn followed a string of MVS versions.Starting with earliest:*OS/VS2 Release 2 through Release 3.8..., zVSE, zVMZ/VMz/VM is the current version in IBM's VM family of virtual machine operating systems. z/VM was first released in October 2000 and remains in active use and development . It is directly based on technology and concepts dating back to the 1960s, with IBM's CP/CMS on the IBM System/360-67..., TPFTransaction Processing FacilityTPF is an IBM real-time operating system for mainframes descended from the IBM System/360 family, including zSeries and System z9. The name is an initialism for Transaction Processing Facility...., IBM i) is X'5A3', and is used in Assembler, PL/IPL/IPL/I is a procedural, imperative computer programming language designed for scientific, engineering, business and systems programming applications..., CobolCOBOLCOBOL is one of the oldest programming languages. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments...., JCLJob Control LanguageJob Control Language is a scripting language used on IBM mainframe operating systems to instruct the system on how to run a batch job or start a subsystem...., scripts, commands and other places. This format was common on other (and now obsolete) IBM systems as well. Occasionally quotation marks were used instead of apostrophes. Donald KnuthDonald KnuthDonald Ervin Knuth is a computer scientist and Professor Emeritus at Stanford University.He is the author of the seminal multi-volume work The Art of Computer Programming. Knuth has been called the "father" of the analysis of algorithms... introduced the use of a particular typeface to represent a particular radix in his book The TeXbook. Hexadecimal representations are written there in a typewriter typeface: 5A3 Any IPv6 addressIPv6 addressAn Internet Protocol Version 6 address is a numerical label that is used to identify a network interface of a computer or other network node participating in an IPv6-enabled computer network.... can be written as eight groups of four hexadecimal digits, where each group is separated by a colon (:). This, for example, is a valid IPv6 address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 ALGOL 68ALGOL 68ALGOL 68 isan imperative computerprogramming language that was conceived as a successor to theALGOL 60 programming language, designed with the goal of a... uses the prefix 16r to denote hexadecimal numbers: 16r5a3. Binary, quaternary (base-4) and octal numbers can be specified similarly.```
``` There is no universal convention to use lowercase or uppercase for the letter digits, and each is prevalent or preferred in particular environments by community standards or convention. Early representations The choice of the letters A through F to represent the digits above nine was not universal in the early history of computers. During the 1950s, some installations favored using the digits 0 through 5 with a macronMacronA macron, from the Greek , meaning "long", is a diacritic placed above a vowel . It was originally used to mark a long or heavy syllable in Greco-Roman metrics, but now marks a long vowel... character ("¯") to denote the values 10–15. Users of Bendix G-15Bendix G-15The Bendix G-15 computer was introduced in 1956 by the Bendix Corporation, Computer Division, Los Angeles, California. It was about 5 by 3 by 3 ft and weighed about 950 lb . The base system, without peripherals, cost \$49,500. A working model cost around \$60,000. It could also be rented for... computers used the letters U through Z. The Librascope LGP-30LGP-30The LGP-30, standing for Librascope General Purpose and then Librascope General Precision, was an early off-the-shelf computer. It was manufactured by the Librascope company of Glendale, California , and sold and serviced by the Royal Precision Electronic Computer Company, a joint venture with the... used the letters F, G, J, K, Q and W. Bruce A. Martin of Brookhaven National LaboratoryBrookhaven National LaboratoryBrookhaven National Laboratory , is a United States national laboratory located in Upton, New York on Long Island, and was formally established in 1947 at the site of Camp Upton, a former U.S. Army base... considered the choice of A–F "ridiculous" and in a 1968 letter to the editor of the CACMCommunications of the ACMCommunications of the ACM is the flagship monthly journal of the Association for Computing Machinery . First published in 1957, CACM is sent to all ACM members, currently numbering about 80,000. The articles are intended for readers with backgrounds in all areas of computer science and information... proposed an entirely new set of symbols based on the bit locations, which did not gain much acceptance. Soviet programmable calculatorProgrammable calculatorProgrammable calculators are calculators that can automatically carry out a sequence of operations under control of a stored program, much like a computer. The first programmable calculators such as the IBM CPC used punched cards or other media for program storage...s Б3-34Elektronika B3-34Elektronika B3-34 was a very popular Soviet programmable calculator. It was released in 1980 and was sold for 85 rubles.B3-34 used Reverse Polish notation and had 98 bytes of instruction memory, 4 stack user registers and 14 addressable registers... and similar used the symbols "−", "L", "C", "Г", "E", " " (space) on their displays. Verbal and digital representations There are no traditional numerals to represent the quantities from ten to fifteen — letters are used as a substitute — and most Western European languages lack non-decimal names for the numerals above ten. Even though English has names for several non-decimal powers (pair for the first binaryBinary numeral systemThe binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2... power, score20 (number)20 is the natural number following 19 and preceding 21. A group of twenty units may also be referred to as a score.-In mathematics:*20 is the basis for vigesimal number systems.... for the first vigesimalVigesimalThe vigesimal or base 20 numeral system is based on twenty .- Places :... power, dozenDozenA dozen is a grouping of approximately twelve. The dozen may be one of the earliest primitive groupings, perhaps because there are approximately a dozen cycles of the moon or months in a cycle of the sun or year..., grossGross (unit)A gross is equal to a dozen dozen, i.e. 12 × 12 = 144.It can be used in duodecimal counting. The use of gross likely originated from the fact that 144 can be counted on the fingers using the fingertips and first two joints of each finger when marked by the thumb of one hand. The other hand..., and great gross for the first three duodecimalDuodecimalThe duodecimal system is a positional notation numeral system using twelve as its base. In this system, the number ten may be written as 'A', 'T' or 'X', and the number eleven as 'B' or 'E'... powers), no English name describes the hexadecimal powers (decimal 16, 256, 4096, 65536, ... ). Some people read hexadecimal numbers digit by digit like a phone number: 4DA is "four-dee-ay". However, the letter A sounds like "eight", C sounds like "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", the Joint Army/Navy Phonetic AlphabetJoint Army/Navy Phonetic AlphabetThe Joint Army/Navy Phonetic Alphabet was a radio alphabet developed in 1941 and was used by all branches of the United States military until the promulgation of the ICAO spelling alphabet in 1956, which replaced it... ("four-dog-able"), or a similar ad hoc system. Systems of counting on digitsDigit (anatomy)A digit is one of several most distal parts of a limb, such as fingers or toes, present in many vertebrates.- Names:Some languages have different names for hand and foot digits .... have been devised for both binary and hexadecimal. Arthur C. ClarkeArthur C. ClarkeSir Arthur Charles Clarke, CBE, FRAS was a British science fiction author, inventor, and futurist, famous for his short stories and novels, among them 2001: A Space Odyssey, and as a host and commentator in the British television series Mysterious World. For many years, Robert A. Heinlein,... 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 −4210 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 −4210 can be written as FFFF FFD6 in a 32-bit CPU registerProcessor registerIn computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly..., as C228 0000 in a 32-bit FPUFloating point unitA floating-point unit is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division, and square root... register or C045 0000 0000 0000 in a 64-bit FPU register (assuming certain representation schemes, two's-complement in the 32-bit non-FPU instance and sign-magnitude in the FPU instances.) Hexadecimal exponential notation Just as decimal numbers can be represented in exponential notation so too can hexadecimal. By convention, the letter p represents times two raised to the power of, whereas e serves a similar purpose in decimal. The number after the p is decimal and represents the binary exponent. Usually the number is normalised: that is, the leading hexadecimal digit is 1 (unless the value is exactly 0). Example: 1.3DEp42 represents 1.3DE16 × 242. Hexadecimal exponential notation is required by the IEEE 754 binary floating-point standard. This notation can be produced by some versions of the printfPrintfPrintf format string refers to a control parameter used by a class of functions typically associated with some types of programming languages. The format string specifies a method for rendering an arbitrary number of varied data type parameter into a string... family of functions by using the %a conversion. 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 (410). This example converts 11112 to base ten. Since each positionPositional notationPositional notation or place-value notation is a method of representing or encoding numbers. Positional notation is distinguished from other notations for its use of the same symbol for the different orders of magnitude... in a binary numeral can contain either a 1 or a 0, its value may be easily determined by its position from the right: 00012 = 110 00102 = 210 01002 = 410 10002 = 810 Therefore: 11112 = 810 + 410 + 210 + 110   = 1510 With little practice, mapping 11112 to F16 in one step becomes easy: see table in Representing hexadecimal. 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. 010111101011010100102 = 26214410 + 6553610 + 3276810 + 1638410 + 819210 + 204810 + 51210 + 25610 + 6410 + 1610 + 210   = 38792210 Compare this to the conversion to hexadecimal, where each group of four digits can be considered independently, and converted directly: 010111101011010100102 = 0101  1110  1011  0101  00102   = 5 E B 5 216   = 5EB5216 The conversion from hexadecimal to binary is equally direct. The octalOctalThe octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Numerals can be made from binary numerals by grouping consecutive binary digits into groups of three... system can also be useful as a tool for people who need to deal directly with binary computer data. Octal represents data as three bits per character, rather than four. Division-remainder in source base As with all bases there is a simple algorithmAlgorithmIn mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning... for converting a representation of a number to hexadecimal by doing integer division and remainder operations in the source base. In theory, this is possible from any base, but for most humans only decimal and for most computers only binary (which can be converted by far more efficient methods) can be easily handled with this method. Let d be the number to represent in hexadecimal, and the series hihi-1...h2h1 be the hexadecimal digits representing the number. i := 1 hi := d mod 16 d := (d-hi) / 16 If d = 0 (return series hi) else increment i and go to step 2 "16" may be replaced with any other base that may be desired. The following is a JavaScriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles.... implementation of the above algorithm for converting any number to a hexadecimal in String representation. Its purpose is to illustrate the above algorithm. To work with data seriously, however, it is much more advisable to work with bitwise operators. function toHex(d) { var r = d % 16; var result; if (d-r 0) result = toChar(r); else result = toHex( (d-r)/16 ) + toChar(r); return result; } function toChar(n) { const alpha = "0123456789ABCDEF"; return alpha.charAt(n); } Addition and multiplication It is also possible to make the conversion by assigning each place in the source base the hexadecimal representation of its place value and then performing multiplication and addition to get the final representation. That is, to convert the number B3AD to decimal one can split the conversion into D (1310), A (1010), 3 (310) and B (1110) then get the final result by multiplying each decimal representation by 16p, where 'p' is the corresponding position from right to left, beginning with 0. In this case we have 13×(160) + 10×(161) + 3×(162) + 11×(163), which is equal 45997 in the decimal system. Tools for conversion Most modern computer systems with graphical user interfaceGraphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...s provide a built-in calculator utility, capable of performing conversions between various radices, in general including hexadecimal. In MicrosoftMicrosoftMicrosoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions... WindowsMicrosoft WindowsMicrosoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal..., the Calculator utility can be set to Scientific mode (called Programmer mode in some versions), which allows conversions between radix 16 (hexadecimal), 10 (decimal), 8 (octalOctalThe octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Numerals can be made from binary numerals by grouping consecutive binary digits into groups of three...) and 2 (binaryBinary numeral systemThe binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2...), the bases most commonly used by programmers. In Scientific Mode, the on-screen numeric keypadNumeric keypadA numeric keypad, numpad or tenkey for short, is the small, palm-sized, seventeen key section of a computer keyboard, usually on the very far right. The numeric keypad features digits 0 to 9, addition , subtraction , multiplication and division symbols, a decimal point and Num Lock and Enter keys... includes the hexadecimal digits A through F, which are active when "Hex" is selected. In hex mode, however, the Windows Calculator supports only integers. Real numbers As with other numeral systems, the hexadecimal system can be used to represent rational numberRational numberIn mathematics, a rational number is any number that can be expressed as the quotient or fraction a/b of two integers, with the denominator b not equal to zero. Since b may be equal to 1, every integer is a rational number...s, although recurring digits are common since sixteen (10h) has only a single prime factor (two):      = 0.8      = 0.2A      = 0.19      = 0.1249      = 0.5      = 0.249      = 0.1745D      = 0.1      = 0.4      = 0.2      = 0.15      = 0.1      = 0.3      = 0.1C7      = 0.13B      = 0.0F where an overline denotes a recurring pattern. 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 binaryBinary numeral systemThe binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2... or dividing one by sixteen for hexadecimal, both of these fractions are written as 0.1. Because the radix 16 is a perfect squareSquare numberIn mathematics, a square number, sometimes also called a perfect square, is an integer that is the square of an integer; in other words, it is the product of some integer with itself... (4²), fractions expressed in hexadecimal have an odd period much more often than decimal ones, and there are no cyclic numberCyclic numberA cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number. The most widely known is 142857:For example:Multiples of these fractions exhibit cyclic permutation:...s (other than trivial single digits). Recurring digits are exhibited when the denominator in lowest terms has a prime factorPrime factorIn number theory, the prime factors of a positive integer are the prime numbers that divide that integer exactly, without leaving a remainder. The process of finding these numbers is called integer factorization, or prime factorization. A prime factor can be visualized by understanding Euclid's... not found in the radix; thus, when using hexadecimal notation, all fractions with denominators that are not a power of twoPower of twoIn mathematics, a power of two means a number of the form 2n where n is an integer, i.e. the result of exponentiation with as base the number two and as exponent the integer n.... result in an infinite string of recurring digits (such as thirds and fifths). This makes hexadecimal (and binary) less convenient than decimalDecimalThe decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations.... 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, duodecimalDuodecimalThe duodecimal system is a positional notation numeral system using twelve as its base. In this system, the number ten may be written as 'A', 'T' or 'X', and the number eleven as 'B' or 'E'..., 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. For example, 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). r>Prime factors of the base: 2, 5 In hexad>cimalPrime factors of the base: 2 Fraction Prime factorsof the denominator Positional representation Positional representation Prime factorsof the denominator Fraction 1/2 2 0.5 0.8 2 1/2 1/3 3 0.3333... = 0. 0.5555... = 0. 3 1/3 1/4 2 0.25 0.4 2 1/4 1/5 5 0.2 0. 5 1/5 1/6 2, 3 0.1 0.2 2, 3 1/6 1/7 7 0. 0. 7 1/7 1/8 2 0.125 0.2 2 1/8 1/9 3 0. 0. 3 1/9 1/10 2, 5 0.1 0.1 2, 5 1/A 1/11 11 0. 0. B 1/B 1/12 2, 3 0.08 0.1 2, 3 1/C 1/13 13 0. 0. D 1/D 1/14 2, 7 0.0 0.1 2, 7 1/E 1/15 3, 5 0.0 0. 3, 5 1/F 1/16 2 0.0625 0.1 2 1/10 1/17 17 0. 0. 11 1/11 1/18 2, 3 0.0 0.0 2, 3 1/12 1/19 19 0. 0.0 13 1/13 1/20 2, 5 0.05 0.0 2, 5 1/14 1/21 3, 7 0. 0. 3, 7 1/15 1/22 2, 11 0.0 0.0 2, B 1/16 1/23 23 0. 0.0 17 1/17 1/24 2, 3 0.041 0.0 2, 3 1/18 1/25 5 0.04 0.0 5 1/19 1/26 2, 13 0.0 0.0 2, B 1/1A 1/27 3 0. 0. 3 1/1B 1/28 2, 7 0.03 0.0 2, 7 1/1C 1/29 29 0. 0. 1D 1/1D 1/30 2, 3, 5 0.0 0.0 2, 3, 5 1/1E 1/31 31 0. 0. 1F 1/1F 1/32 2 0.03125 0.08 2 1/20 1/33 3, 11 0. 0. 3, B 1/21 1/34 2, 17 0.0 0.0 2, 11 1/22 1/35 5, 7 0.0 0. 5, 7 1/23 1/36 2, 3 0.02 0.0 2, 3 1/24 Algebraic irrational number In decimal In hexadecimal √2Square root of 2The square root of 2, often known as root 2, is the positive algebraic number that, when multiplied by itself, gives the number 2. It is more precisely called the principal square root of 2, to distinguish it from the negative number with the same property.Geometrically the square root of 2 is the... (the length of the diagonalDiagonalA diagonal is a line joining two nonconsecutive vertices of a polygon or polyhedron. Informally, any sloping line is called diagonal. The word "diagonal" derives from the Greek διαγώνιος , from dia- and gonia ; it was used by both Strabo and Euclid to refer to a line connecting two vertices of a... of a unit squareSquare (geometry)In geometry, a square is a regular quadrilateral. This means that it has four equal sides and four equal angles...) 1.41421356237309... 1.6A09E667F3BCD... √3Square root of 3The square root of 3 is the positive real number that, when multiplied by itself, gives the number 3. It is more precisely called the principal square root of 3, to distinguish it from the negative number with the same property... (the length of the diagonal of a unit cubeCubeIn geometry, a cube is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex. The cube can also be called a regular hexahedron and is one of the five Platonic solids. It is a special kind of square prism, of rectangular parallelepiped and...) 1.73205080756887... 1.BB67AE8584CAA... √5 (the length of the diagonalDiagonalA diagonal is a line joining two nonconsecutive vertices of a polygon or polyhedron. Informally, any sloping line is called diagonal. The word "diagonal" derives from the Greek διαγώνιος , from dia- and gonia ; it was used by both Strabo and Euclid to refer to a line connecting two vertices of a... of a 1×2 rectangleRectangleIn Euclidean plane geometry, a rectangle is any quadrilateral with four right angles. The term "oblong" is occasionally used to refer to a non-square rectangle...) 2.2360679774997... 2.3C6EF372FE95... φGolden ratioIn mathematics and the arts, two quantities are in the golden ratio if the ratio of the sum of the quantities to the larger quantity is equal to the ratio of the larger quantity to the smaller one. The golden ratio is an irrational mathematical constant, approximately 1.61803398874989... (phi, the golden ratioGolden ratioIn mathematics and the arts, two quantities are in the golden ratio if the ratio of the sum of the quantities to the larger quantity is equal to the ratio of the larger quantity to the smaller one. The golden ratio is an irrational mathematical constant, approximately 1.61803398874989... = 1.6180339887498... 1.9E3779B97F4A... Transcendental irrational number     πPi' is a mathematical constant that is the ratio of any circle's circumference to its diameter. is approximately equal to 3.14. Many formulae in mathematics, science, and engineering involve , which makes it one of the most important mathematical constants... (pi, the ratio of circumferenceCircumferenceThe circumference is the distance around a closed curve. Circumference is a special perimeter.-Circumference of a circle:The circumference of a circle is the length around it.... to diameterDiameterIn geometry, a diameter of a circle is any straight line segment that passes through the center of the circle and whose endpoints are on the circle. The diameters are the longest chords of the circle...) 3.14159265358979323846264338327950288419716939937510... 3.243F6A8885A308D313198A2E03707344A4093822299F31D008... eE (mathematical constant)The mathematical constant ' is the unique real number such that the value of the derivative of the function at the point is equal to 1. The function so defined is called the exponential function, and its inverse is the natural logarithm, or logarithm to base... (the base of the natural logarithmNatural logarithmThe natural logarithm is the logarithm to the base e, where e is an irrational and transcendental constant approximately equal to 2.718281828...) 2.7182818284590452... 2.B7E151628AED2A6B... τ (the Thue–Morse constant) 0.412454033640... 0.6996 9669 9669 6996 ... Number     γEuler-Mascheroni constantThe Euler–Mascheroni constant is a mathematical constant recurring in analysis and number theory, usually denoted by the lowercase Greek letter .... (the limiting difference between the harmonic seriesHarmonic series (mathematics)In mathematics, the harmonic series is the divergent infinite series:Its name derives from the concept of overtones, or harmonics in music: the wavelengths of the overtones of a vibrating string are 1/2, 1/3, 1/4, etc., of the string's fundamental wavelength... and the natural logarithm) 0.5772156649015328606... 0.93C467E37DB0C7A4D1B... Powers Possibly the most widely used powers, powers of two, are easier to show using base 16. The first sixteen powers of two are shown below. 2x value 20 1 21 2 22 4 23 8 24 10hex 25 20hex 26 40hex 27 80hex 28 100hex 29 200hex 2A () 400hex 2B () 800hex 2C () 1000hex 2D () 2000hex 2E () 4000hex 2F () 8000hex 210 () 10000hex Since four squared is sixteen, powers of four have an even easier relation: 4x value 40 1 41 4 42 10hex 43 40hex 44 100hex 45 400hex 46 1000hex 47 4000hex 48 10000hex This also makes tetrationTetrationIn mathematics, tetration is an iterated exponential and is the next hyper operator after exponentiation. The word tetration was coined by English mathematician Reuben Louis Goodstein from tetra- and iteration. Tetration is used for the notation of very large numbers... easier when using two and four since: 32 = 24 = 10hex, 42 = 216 = 10000hex and 52 = 265536 = (1 followed by 16384 zeros)hex. Etymology The word hexadecimal is composed of hexa-, derived from the GreekGreek languageGreek is an independent branch of the Indo-European family of languages. Native to the southern Balkans, it has the longest documented history of any Indo-European language, spanning 34 centuries of written records. Its writing system has been the Greek alphabet for the majority of its history;... έξ (hex) for "six", and -decimal, derived from the LatinLatinLatin is an Italic language originally spoken in Latium and Ancient Rome. It, along with most European languages, is a descendant of the ancient Proto-Indo-European language. Although it is considered a dead language, a number of scholars and members of the Christian clergy speak it fluently, and... for "tenth". Webster's Third New International online derives "hexadecimal" as an alteration of the all-Latin "sexadecimal" (which appears in the earlier Bendix documentation). The earliest date attested for "hexadecimal" in Merriam-Webster Collegiate online is 1954, placing it safely in the category of international scientific vocabularyInternational Scientific VocabularyInternational scientific vocabulary comprises scientific and specialized words whose language of origin may or may not be certain, but which are in current use in several modern languages. The name "International Scientific Vocabulary" was first used by Philip Gove in Webster’s Third New... (ISV). It is common in ISV to mix Greek and Latin combining forms freely. The word "sexagesimal" (for base 60) retains the Latin prefix. Donald KnuthDonald KnuthDonald Ervin Knuth is a computer scientist and Professor Emeritus at Stanford University.He is the author of the seminal multi-volume work The Art of Computer Programming. Knuth has been called the "father" of the analysis of algorithms... has pointed out that the etymologically correct term is "senidenary", from the Latin term for "grouped by 16". (The terms "binary", "ternary" and "quaternary" are from the same Latin construction, and the etymologically correct term for "decimal" arithmetic is "denary".) Schwartzman notes that the expected form from usual Latin phrasing would be "sexadecimal", but computer hackers would be tempted to shorten that word to "sex". The etymologicallyEtymologyEtymology is the study of the history of words, their origins, and how their form and meaning have changed over time.For languages with a long written history, etymologists make use of texts in these languages and texts about the languages to gather knowledge about how words were used during... proper GreekGreek languageGreek is an independent branch of the Indo-European family of languages. Native to the southern Balkans, it has the longest documented history of any Indo-European language, spanning 34 centuries of written records. Its writing system has been the Greek alphabet for the majority of its history;... term would be hexadecadic (although in Modern GreekModern GreekModern Greek refers to the varieties of the Greek language spoken in the modern era. The beginning of the "modern" period of the language is often symbolically assigned to the fall of the Byzantine Empire in 1453, even though that date marks no clear linguistic boundary and many characteristic... deca-hexadic (δεκαεξαδικός) is more commonly used). Use in Chinese culture The traditional Chinese units of weightChinese units of measurementChinese units of measurement are the customary and traditional units of measure used in China. In the People's Republic of China, the units were re-standardised during the late 20th century to make them approximate SI units. Many of the units were formerly based on the number 16 instead of 10... were base-16. For example, one jīn (斤) (approximately 256 grams) in the old system equals sixteen liǎng (兩) (16g). The suanpan (Chinese abacusAbacusThe abacus, also called a counting frame, is a calculating tool used primarily in parts of Asia for performing arithmetic processes. Today, abaci are often constructed as a bamboo frame with beads sliding on wires, but originally they were beans or stones moved in grooves in sand or on tablets of...) could be used to perform hexadecimal calculations. Common patterns and humor Hexadecimal is sometimes used in programmer jokes because some words can be formed using hexadecimal digits. Some of these words are "dead", "beef", "babe", and with appropriate substitutions "c0ffee". Since these are quickly recognizable by programmers, debugging setups sometimes initialize memory to them to help programmers see when something has not been initialized. An example is the magic numberMagic number (programming)In computer programming, the term magic number has multiple meanings. It could refer to one or more of the following:* A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures... in UniversalUniversal binaryA universal binary is, in Apple parlance, an executable file or application bundle that runs natively on either PowerPC or Intel-manufactured IA-32 or Intel 64-based Macintosh computers; it is an implementation of the concept more generally known as a fat binary.With the release of Mac OS X Snow... Mach-OMach-OMach-O, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. A replacement for the a.out format, Mach-O offered more extensibility and faster access to information in the symbol table.Mach-O was once used by... files and java class file structure, which is "CAFEBABE". Single-architecture 32-bit big-endian Mach-O files have the magic number "FEEDFACE" at their beginning. "DEADBEEF" is sometimes put into uninitialized memory. Microsoft Windows XP clears its locked index.dat files with the hex codes: "0BADF00D". The Visual C++ remote debugger uses "BADCAB1E" to denote a broken link to the target system. Two common bit patterns often employed to test hardware are 01010101 and 10101010 (their corresponding hex values are 55h and AAh, respectively). The reason for their use is to alternate between off ('0') to on ('1') or vice versa when switching between these two patterns. These two values are often used together as signatures in critical PC system sectors (e.g., the hex word, 0xAA55, which on little-endianEndiannessIn computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits... systems is 55h followed by AAh, must be at the end of a valid Master Boot RecordMaster boot recordA master boot record is a type of boot sector popularized by the IBM Personal Computer. It consists of a sequence of 512 bytes located at the first sector of a data storage device such as a hard disk...). The following table shows a joke in hexadecimal: 3x12=36 2x12=24 1x12=12 0x12=18 The first three are interpreted as multiplication, but in the last, "0x" signals Hexadecimal interpretation of 12, which is 18. Another joke based on the use of a word containing only letters from the first six in the alphabet (and thus those used in hexadecimal) is... If only dead people understand hexadecimal, how many people understand hexadecimal? In this case, "dead" refers to a hexadecimal number DEAD (57005 base 10), as opposed to the state of being deceased. A Knuth reward checkKnuth reward checkKnuth reward checks are awarded by computer scientist Donald Knuth for finding mistakes in, or making suggestions for, his publications. In the preface of each of his books and on his website, Knuth offers a reward of \$2.56 to the first person to find each error in his published books, whether it... is one hexadecimal dollar, or \$2.56. Primary numeral system Similar to dozenal advocacy, there have been occasional attempts to promote hexadecimal as the preferred numeral system. These attempts usually propose pronunciation and/or symbology. Sometimes the proposal unifies standard measures so that they are multiples of 16. An example of unifying standard measures is Hexadecimal timeHexadecimal timeHexadecimal time is the representation of the time of day as a hexadecimal number in the interval [0,1). The day is divided in 1016 hexadecimal hours, each hour in 10016 hexadecimal minutes and each minute in 1016 hexadecimal seconds.This time format was first proposed by the..., which subdivides a day by 16 so that there are 16 "hexhours" in a day. Key to number base notation Simple key for notations used in article: Full Text Notation Abbreviation Number Base binary bin 2 octal oct 8 decimal dec 10 hexadecimal hex 16 External links If you're here, you're probably thinking about adding an external link to an online calculator or some such. Some points to keep in mind (from the policy at WP:EL, http://en.wikipedia.org/w/index.php?title=Wikipedia:External_links): The "External links" section should be kept to a minimum. A lack of external links ... is not a reason to add them. Links to be avoided: Any site that does not provide a unique resource beyond what the article might contain... Links mainly intended to promote a website Sites that are only indirectly related to the article's subject Since the article is about hexadecimal representation and mentions standard tools for conversion only as a minor example, there is little any external link to an online calculator or converter could possibly add to the reader's knowledge. --> ShowWikipediaFooter("Hexadecimal") ```
``` ```
``` ```
``` ShowPageFooter() ```
``` ```
``` var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-395964-1"); pageTracker._trackPageview(); } catch (err) { } ```