# Binary code

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Binary_code
> Markdown URL: https://mediated.wiki/source/Binary_code.md
> Source: https://en.wikipedia.org/wiki/Binary_code
> Source revision: 1355690091
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Encoded data represented in binary notation

For the binary form of computer software, see [Machine code](/source/Machine_code).

The ASCII-encoded letters of "Wikipedia" represented as binary codes.

A **binary code** is the value of a [data-encoding](/source/Data_encoding) convention represented in a [binary](/source/Binary_number) notation that usually is a sequence of 0s and 1s, sometimes called a *[bit](/source/Bit) string*. For example, [ASCII](/source/ASCII) is an 8-bit text encoding that in addition to the [human readable](/source/Human_readable) form (letters) can be represented as binary. *Binary code* can also refer to the [mass noun](/source/Mass_noun) *code* that is not human readable in nature such as [machine code](/source/Machine_code) and [bytecode](/source/Bytecode).

Even though all modern computer data is binary in nature, and therefore can be represented as binary, other [numerical bases](/source/Numerical_base) may be used. [Power of 2](/source/Power_of_2) bases (including [hex](/source/Hexadecimal) and [octal](/source/Octal)) are sometimes considered binary code since their power-of-2 nature makes them inherently linked to binary. [Decimal](/source/Decimal) is, of course, a commonly used representation. For example, ASCII characters are often represented as either decimal or hex. Some types of data such as [image](/source/Image) data is sometimes represented as hex, but rarely as decimal.

## History

Further information: [Binary number § History](/source/Binary_number#History)

This section's factual accuracy is disputed. Relevant discussion may be found on the talk page. Please help to ensure that disputed statements are reliably sourced. (April 2015) (Learn how and when to remove this message)

[Gottfried Leibniz](/source/Gottfried_Leibniz)

### Invention

The modern binary number system, the basis for binary code, is an invention by [Gottfried Leibniz](/source/Gottfried_Leibniz) in 1689 and appears in his article *Explication de l'Arithmétique Binaire (*English: *Explanation of the Binary Arithmetic*) which uses only the characters 1 and 0, and some remarks on its usefulness. Leibniz's system uses 0 and 1, like the modern binary numeral system. Binary numerals were central to Leibniz's intellectual and theological ideas. He believed that binary numbers were symbolic of the Christian idea of *[creatio ex nihilo](/source/Creatio_ex_nihilo)* or creation out of nothing.[1][2] In Leibniz's view, binary numbers represented a fundamental form of creation, reflecting the simplicity and unity of the divine.[2] Leibniz was also attempting to find a way to translate logical reasoning into pure mathematics. He viewed the binary system as a means of simplifying complex logical and mathematical processes, believing that it could be used to express all concepts of arithmetic and logic.[2]

### Previous Ideas

Leibniz explained in his work that he encountered the *[I Ching](/source/I_Ching)* by [Fu Xi](/source/Fu_Xi)[2] that dates from the 9th century BC in China,[3] through French Jesuit [Joachim Bouvet](/source/Joachim_Bouvet) and noted with fascination how its [hexagrams](/source/Hexagram_(I_Ching)) correspond to the binary numbers from 0 to 111111, and concluded that this mapping was evidence of major Chinese accomplishments in the sort of philosophical visual binary [mathematics](/source/Mathematics) he admired.[4][5] Leibniz saw the hexagrams as an affirmation of the universality of his own religious belief.[5] After Leibniz ideas were ignored, the book had confirmed his theory that life could be simplified or reduced down to a series of straightforward propositions. He created a system consisting of rows of zeros and ones. During this time period, Leibniz had not yet found a use for this system.[6] The binary system of the *I Ching* is based on the duality of [yin and yang](/source/Yin_and_yang).[7] [Slit drums](/source/Slit_drum) with binary tones are used to encode messages across Africa and Asia.[7] The Indian scholar [Pingala](/source/Pingala) (around 5th–2nd centuries BC) developed a binary system for describing [prosody](/source/Prosody_(poetry)) in his *Chandashutram*.[8][9]

[Mangareva](/source/Mangareva) people in [French Polynesia](/source/French_Polynesia) were using a hybrid binary-[decimal](/source/Decimal) system before 1450.[10] In the 11th century, scholar and philosopher [Shao Yong](/source/Shao_Yong) developed a method for arranging the hexagrams which corresponds, albeit unintentionally, to the sequence 0 to 63, as represented in binary, with yin as 0, yang as 1 and the [least significant bit](/source/Least_significant_bit) on top. The ordering is also the [lexicographical order](/source/Lexicographical_order) on [sextuples](/source/Sextuple) of elements chosen from a two-element set.[11]

[George Boole](/source/George_Boole)

In 1605 [Francis Bacon](/source/Francis_Bacon) discussed a system whereby letters of the alphabet could be reduced to sequences of binary digits, which could then be encoded as scarcely visible variations in the font in any random text.[12] Importantly for the general theory of binary encoding, he added that this method could be used with any objects at all: "provided those objects be capable of a twofold difference only; as by Bells, by Trumpets, by Lights and Torches, by the report of Muskets, and any instruments of like nature".[12]

### Boolean Logical System

[George Boole](/source/George_Boole) published a paper in 1847 called 'The Mathematical Analysis of Logic' that describes an algebraic system of logic, now known as [Boolean algebra](/source/Boolean_algebra_(logic)). Boole's system was based on binary, a yes-no, on-off approach that consisted of the three most basic operations: AND, OR, and NOT.[13] This system was not put into use until a graduate student from [Massachusetts Institute of Technology](/source/Massachusetts_Institute_of_Technology), [Claude Shannon](/source/Claude_Shannon), noticed that the Boolean algebra he learned was similar to an electric circuit. In 1937, Shannon wrote his master's thesis, *[A Symbolic Analysis of Relay and Switching Circuits](/source/A_Symbolic_Analysis_of_Relay_and_Switching_Circuits)*, which implemented his findings. Shannon's thesis became a starting point for the use of the binary code in practical applications such as computers, electric circuits, and more.[14]

### Timeline

- 1875: [Émile Baudot](/source/%C3%89mile_Baudot) "Addition of binary strings in his ciphering system," which, eventually, led to the ASCII of today.

- 1884: The [Linotype machine](/source/Linotype_machine) where the matrices are sorted to their corresponding channels after use by a binary-coded slide rail.

- 1932: [C. E. Wynn-Williams](/source/C._E._Wynn-Williams) "Scale of Two" counter[15]

- 1937: [Alan Turing](/source/Alan_Turing) electro-mechanical binary multiplier

- 1937: [George Stibitz](/source/George_Stibitz) ["excess three" code](/source/Excess_three_code) in the [Complex Computer](/source/George_Stibitz#Computer)[15]

- 1937: [Atanasoff–Berry Computer](/source/Atanasoff%E2%80%93Berry_Computer)[15]

- 1938: [Konrad Zuse](/source/Konrad_Zuse) [Z1](/source/Z1_(computer))

## Rendering

This section may contain original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (March 2015) (Learn how and when to remove this message)

Daoist Bagua

A binary code can be rendered using any two distinguishable indications. In addition to the bit string, other notable ways to render a binary code are described below.

**Braille**
- [Braille](/source/Braille) is a binary code that is widely used to enable the blind to read and write by touch. The system consists of grids of six dots each, three per column, in which each dot is either raised or flat (not raised). The different combinations of raised and flat dots encode information such as letters, numbers, and punctuation.

**Bagua**
- The *[bagua](/source/Bagua)* is a set of diagrams used in *[feng shui](/source/Feng_shui),* [Taoist](/source/Taoist) [cosmology](/source/Cosmology) and *[I Ching](/source/I_Ching)* studies. The *ba gua* consists of 8 trigrams, each a combination of three lines (*yáo*) that are either broken ([*yin*](/source/Yin_and_yang)) or unbroken (*yang*).[16]

**Ifá**
- The [Ifá](/source/If%C3%A1)/Ifé system of divination in African religions, such as of [Yoruba](/source/Yoruba_people), [Igbo](/source/Igbo_people), and [Ewe](/source/Ewe_people), consists of an elaborate traditional ceremony producing 256 oracles made up by 16 symbols with 256 = 16 x 16. A priest, or [Babalawo](/source/Babalawo), requests sacrifice from consulting clients and makes prayers. Then, divination [nuts](/source/Nut_(fruit)) or a pair of [chains](/source/Chain) are used to produce random binary numbers,[17] which are drawn with sandy material on an "Opun" figured wooden tray representing the totality of fate.[18]

## Encoding

An example of a recursive [binary space partitioning](/source/Binary_space_partitioning) [quadtree](/source/Quadtree) for a 2D index

Innumerable encoding systems exists. Some notable examples are described here.

**ASCII**
- The [American Standard Code for Information Interchange](/source/American_Standard_Code_for_Information_Interchange) (ASCII) character encoding, is a 7-bit convention for representing (normal/printing) characters and [control](/source/Control_character) operations. Each printing and control character is assigned a number from 0 to 127. For example, "a" is represented by decimal code 97 which is rendered as bit string 1100001.

**Binary-coded decimal**
- [Binary-coded decimal](/source/Binary-coded_decimal) (BCD) is an encoding of integer values that consists of a 4-bit [nibble](/source/Nibble) for each decimal digit. As a decimal digit is only 1 of 10 values (0 to 9) but 4 bits can encode up to 16 values, and BCD element is invalid for a value greater than 9.[19]

## See also

- [Binary file](/source/Binary_file) – Computer file encoded in binary form

- [Bit array](/source/Bit_array) – Array data structure that compactly stores bits

- [Constant-weight code](/source/Constant-weight_code) – Method for encoding data in communications

- [Gray code](/source/Gray_code) – Ordering of binary values, used for positioning and error correction

- [List of binary codes](/source/List_of_binary_codes)

- [Unicode](/source/Unicode) – Character encoding standard

## References

1. **[^](#cite_ref-on_1-0)** Yuen-Ting Lai (1998). [*Leibniz, Mysticism and Religion*](https://books.google.com/books?id=U9dOmVt81UAC&pg=PA149). Springer. pp. 149–150. [ISBN](/source/ISBN_(identifier)) [978-0-7923-5223-5](https://en.wikipedia.org/wiki/Special:BookSources/978-0-7923-5223-5).

1. ^ [***a***](#cite_ref-lnz_2-0) [***b***](#cite_ref-lnz_2-1) [***c***](#cite_ref-lnz_2-2) [***d***](#cite_ref-lnz_2-3) Leibniz G., Explication de l'Arithmétique Binaire, Die Mathematische Schriften, ed. C. Gerhardt, Berlin 1879, vol.7, p.223; Engl. transl.[\[1\]](http://www.leibniz-translations.com/binary.htm)

1. **[^](#cite_ref-HackerMoore2002_3-0)** Edward Hacker; Steve Moore; Lorraine Patsco (2002). [*I Ching: An Annotated Bibliography*](https://books.google.com/books?id=S5hLpfFiMCQC&pg=PR13). Routledge. p. 13. [ISBN](/source/ISBN_(identifier)) [978-0-415-93969-0](https://en.wikipedia.org/wiki/Special:BookSources/978-0-415-93969-0).

1. **[^](#cite_ref-4)** Aiton, Eric J. (1985). *Leibniz: A Biography*. Taylor & Francis. pp. 245–8. [ISBN](/source/ISBN_(identifier)) [978-0-85274-470-3](https://en.wikipedia.org/wiki/Special:BookSources/978-0-85274-470-3).

1. ^ [***a***](#cite_ref-smith_5-0) [***b***](#cite_ref-smith_5-1) J.E.H. Smith (2008). [*Leibniz: What Kind of Rationalist?: What Kind of Rationalist?*](https://books.google.com/books?id=Da_oP3sJs1oC&pg=PA4153). Springer. p. 415. [ISBN](/source/ISBN_(identifier)) [978-1-4020-8668-7](https://en.wikipedia.org/wiki/Special:BookSources/978-1-4020-8668-7).

1. **[^](#cite_ref-Gottfried_Leibniz_6-0)** ["Gottfried Wilhelm Leibniz (1646 - 1716)"](http://www.kerryr.net/pioneers/leibniz.htm). *www.kerryr.net*.

1. ^ [***a***](#cite_ref-scientific_7-0) [***b***](#cite_ref-scientific_7-1) Jonathan Shectman (2003). [*Groundbreaking Scientific Experiments, Inventions, and Discoveries of the 18th Century*](https://books.google.com/books?id=SsbChdIiflsC&pg=PA29). Greenwood Publishing. p. 29. [ISBN](/source/ISBN_(identifier)) [978-0-313-32015-6](https://en.wikipedia.org/wiki/Special:BookSources/978-0-313-32015-6).

1. **[^](#cite_ref-8)** Sanchez, Julio; Canton, Maria P. (2007). *Microcontroller programming: the microchip PIC*. Boca Raton, Florida: CRC Press. p. 37. [ISBN](/source/ISBN_(identifier)) [978-0-8493-7189-9](https://en.wikipedia.org/wiki/Special:BookSources/978-0-8493-7189-9).

1. **[^](#cite_ref-9)** W. S. Anglin and J. Lambek, *The Heritage of Thales*, Springer, 1995, [ISBN](/source/ISBN_(identifier)) [0-387-94544-X](https://en.wikipedia.org/wiki/Special:BookSources/0-387-94544-X)

1. **[^](#cite_ref-10)** Bender, Andrea; Beller, Sieghard (16 December 2013). ["Mangarevan invention of binary steps for easier calculation"](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3910603). *Proceedings of the National Academy of Sciences*. **111** (4): 1322–1327. [doi](/source/Doi_(identifier)):[10.1073/pnas.1309160110](https://doi.org/10.1073%2Fpnas.1309160110). [PMC](/source/PMC_(identifier)) [3910603](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3910603). [PMID](/source/PMID_(identifier)) [24344278](https://pubmed.ncbi.nlm.nih.gov/24344278).

1. **[^](#cite_ref-11)** Ryan, James A. (January 1996). "Leibniz' Binary System and Shao Yong's "Yijing"". *Philosophy East and West*. **46** (1): 59–90. [doi](/source/Doi_(identifier)):[10.2307/1399337](https://doi.org/10.2307%2F1399337). [JSTOR](/source/JSTOR_(identifier)) [1399337](https://www.jstor.org/stable/1399337).

1. ^ [***a***](#cite_ref-Bacon1605_12-0) [***b***](#cite_ref-Bacon1605_12-1) [Bacon, Francis](/source/Francis_Bacon) (1605). ["The Advancement of Learning"](http://home.hiwaay.net/~paul/bacon/advancement/book6ch1.html). London. pp. Chapter 1.

1. **[^](#cite_ref-Boolean_operations_13-0)** ["What's So Logical About Boolean Algebra?"](http://www.kerryr.net/pioneers/boolean.htm). *www.kerryr.net*.

1. **[^](#cite_ref-Claude_Shannon_14-0)** ["Claude Shannon (1916 - 2001)"](http://www.kerryr.net/pioneers/shannon.htm). *www.kerryr.net*.

1. ^ [***a***](#cite_ref-Glaser_15-0) [***b***](#cite_ref-Glaser_15-1) [***c***](#cite_ref-Glaser_15-2) [Glaser 1971](#CITEREFGlaser1971)

1. **[^](#cite_ref-wilhelm_16-0)** [Wilhelm, Richard](/source/Richard_Wilhelm_(sinologist)) (1950). [*The I Ching or Book of Changes*](https://books.google.com/books?id=bbU9AAAAIAAJ&pg=PA266). trans. by [Cary F. Baynes](/source/Cary_F._Baynes), foreword by [C. G. Jung](/source/C._G._Jung), preface to 3rd ed. by [Hellmut Wilhelm](/source/Hellmut_Wilhelm) (1967). Princeton, NJ: Princeton University Press. pp. 266, 269. [ISBN](/source/ISBN_(identifier)) [978-0-691-09750-3](https://en.wikipedia.org/wiki/Special:BookSources/978-0-691-09750-3). {{[cite book](https://en.wikipedia.org/wiki/Template:Cite_book)}}: ISBN / Date incompatibility ([help](https://en.wikipedia.org/wiki/Help:CS1_errors#invalid_isbn_date))

1. **[^](#cite_ref-17)** Olupona, Jacob K. (2014). *African Religions: A Very Short Introduction*. Oxford: [Oxford University Press](/source/Oxford_University_Press). p. 45. [ISBN](/source/ISBN_(identifier)) [978-0-19-979058-6](https://en.wikipedia.org/wiki/Special:BookSources/978-0-19-979058-6). [OCLC](/source/OCLC_(identifier)) [839396781](https://search.worldcat.org/oclc/839396781).

1. **[^](#cite_ref-18)** Eglash, Ron (June 2007). ["The fractals at the heart of African designs"](https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next#t-13472). *www.ted.com*. [Archived](https://web.archive.org/web/20210727161435/https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next) from the original on 2021-07-27. Retrieved 2021-04-15.

1. **[^](#cite_ref-Cowlishaw_GDA_19-0)** [Cowlishaw, Mike F.](/source/Mike_F._Cowlishaw) (2015) [1981, 2008]. ["General Decimal Arithmetic"](http://speleotrove.com/decimal/). IBM. Retrieved 2016-01-02.

## External links

- [Sir Francis Bacon's BiLiteral Cypher system](https://web.archive.org/web/20160923014940/http://www.baconlinks.com/docs/BILITERAL.doc), predates binary number system.

- [Weisstein, Eric W.](/source/Eric_W._Weisstein) ["Error-Correcting Code"](https://mathworld.wolfram.com/Error-CorrectingCode.html). *[MathWorld](/source/MathWorld)*.

- [Table of general binary codes](http://www.win.tue.nl/~aeb/codes/binary.html). An updated version of the tables of bounds for small general binary codes given in M.R. Best; A.E. Brouwer; F.J. MacWilliams; A.M. Odlyzko; N.J.A. Sloane (1978), "Bounds for Binary Codes of Length Less than 25", *IEEE Trans. Inf. Theory*, **24**: 81–93, [CiteSeerX](/source/CiteSeerX_(identifier)) [10.1.1.391.9930](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.391.9930), [doi](/source/Doi_(identifier)):[10.1109/tit.1978.1055827](https://doi.org/10.1109%2Ftit.1978.1055827).

- [Table of Nonlinear Binary Codes](https://web.archive.org/web/20170423014446/http://www.eng.tau.ac.il/~litsyn/tableand/). Maintained by Simon Litsyn, E. M. Rains, and N. J. A. Sloane. Updated until 1999.

- Glaser, Anton (1971). "Chapter VII Applications to Computers". *History of Binary and other Nondecimal Numeration*. Tomash. [ISBN](/source/ISBN_(identifier)) [978-0-938228-00-4](https://en.wikipedia.org/wiki/Special:BookSources/978-0-938228-00-4). cites some pre-ENIAC milestones.

- [First book in the world fully written in binary code](https://www.amazon.it/01010011-01100101-01100111-01110010-01110100/dp/B0CHD5Q8W1/ref=sr_1_1?qid=1694173977&refinements=p_27:%22Luigi+Usai%22&s=books&sr=1-1&ufe=app_do:amzn1.fos.9d4f9b77-768c-4a4e-94ad-33674c20ab35): (IT) Luigi Usai, *01010011 01100101 01100111 01110010 01100101 01110100 01101001*, Independently published, 2023, [ISBN](/source/ISBN_(identifier)) [979-8-8604-3980-1](https://en.wikipedia.org/wiki/Special:BookSources/979-8-8604-3980-1). URL consulted September 8, 2023.

---
Adapted from the Wikipedia article [Binary code](https://en.wikipedia.org/wiki/Binary_code) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Binary_code?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
