{
  "id": "byte",
  "title": "Byte",
  "lang": "en",
  "source_lang": "en",
  "summary": "A byte is a unit of digital information, conventionally consisting of eight bits, used to measure, store, address, and transmit computer data.",
  "category": "computer-science",
  "subcategory": "hardware",
  "type": "concept",
  "aliases": [],
  "generated_at": "2026-11-02",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/byte/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/byte/",
      "json": "https://aiwiki.page/zh/byte.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A byte is a unit of digital information that, in modern usage, consists of eight bits. An eight-bit byte has \\(2^8 = 256\\) possible bit patterns. Bytes are fundamental units for representing data, measuring storage capacity, and addressing memory in a computer. Historically, the number of bits in a byte varied between systems; the term octet specifies exactly eight bits and is often used in networking standards to avoid this ambiguity."
    },
    {
      "heading": "Representation and meaning",
      "text": "A bit has two possible values, conventionally written as 0 and 1. Grouping eight bits produces a byte, whose meaning depends on how a system interprets it.\n\nFor an unsigned binary integer, a byte represents values from 0 through 255. If its bits are \\(b_7,b_6,\\ldots,b_0\\), its value is\n\n\\[v = \\sum_{i=0}^{7} b_i 2^i.\\]\n\nUnder the widely used two’s-complement interpretation, an eight-bit signed integer instead represents values from \\(-128\\) through \\(127\\). The same bit pattern can therefore have different meanings: 11111111 represents 255 as an unsigned integer and \\(-1\\) as an eight-bit two’s-complement integer.\n\nA byte need not represent a number. It may contain a character code, part of an image sample, several independent flags, a machine instruction fragment, or part of a larger value. Its meaning is determined by a data format, program, or communication protocol, not by the byte itself.\n\nHexadecimal notation is especially convenient for writing byte values because one hexadecimal digit represents four bits. An eight-bit byte can therefore be written as two hexadecimal digits, from 00 to FF. For example, the binary pattern 01000001 is hexadecimal 41 and decimal 65; in ASCII, it represents the uppercase letter A.\n\nFour bits are commonly called a nibble. A machine word, by contrast, is a grouping associated with a processor architecture. Words are often composed of multiple bytes, but word size and byte size are distinct properties."
    },
    {
      "heading": "Historical development",
      "text": "Werner Buchholz coined the term byte in 1956 while working at IBM on the Stretch computer project. The spelling deliberately differed from bite to reduce confusion with bit. Early uses did not establish a universal eight-bit size: computer designs employed different groupings according to their instruction sets, memory organization, and character representations.\n\nThe eight-bit byte became increasingly influential during the 1960s. IBM’s System/360 family, introduced in 1964, was an important contributor to its widespread adoption. Eight bits accommodated a substantial character repertoire while also fitting conveniently into larger binary word sizes.\n\nAs eight-bit character storage, semiconductor memories, and byte-oriented processor architectures became widespread, eight bits became the overwhelmingly dominant byte size. Nevertheless, historical documentation and some programming-language standards retain a more general meaning. Statements about byte size must therefore distinguish modern convention from architecture-specific or language-specific definitions."
    },
    {
      "heading": "Bytes in memory and processors",
      "text": "Byte addressing\n\nIn a byte-addressable machine, each memory address identifies a byte. Consecutive addresses refer to consecutive bytes, while a larger object occupies a sequence of addresses.\n\nByte addressing does not imply that the hardware physically reads or writes only one byte at a time. A central processing unit may transfer larger groups through its registers and memory interfaces. Caches and other parts of the memory hierarchy also operate on units larger than individual bytes.\n\nAn object’s byte count is not necessarily equal to its total contribution to a program’s memory use. Alignment requirements, padding, object metadata, and memory-allocation overhead can increase the space required. Similarly, the members of a data structure may be separated by padding rather than packed consecutively.\n\nByte order\n\nA value occupying multiple bytes requires a convention for ordering those bytes. Endianness describes this ordering:\n\n- Big-endian: the most significant byte occupies the lowest address.\n- Little-endian: the least significant byte occupies the lowest address.\n\nFor example, the 32-bit hexadecimal value 12345678 is stored as 12 34 56 78 in big-endian order and 78 56 34 12 in little-endian order.\n\nEndianness concerns the arrangement of bytes within a larger value; it does not change the value of an individual byte. It is also distinct from the order in which bits are transmitted over a physical connection. File formats and network protocols commonly specify byte order so that systems with different internal representations can exchange data."
    },
    {
      "heading": "Bytes in programming languages",
      "text": "Programming languages expose bytes in different ways. Some provide explicit eight-bit integer types or byte-array types. Others define a byte through the storage model of the implementation.\n\nIn the C programming language, a byte is the addressable storage unit used to hold a character. The expression sizeof(char) is always 1, but this does not require a C byte to contain exactly eight bits. The number of bits in a byte is given by CHAR_BIT, which must be at least 8.\n\nOn most contemporary general-purpose C implementations, CHAR_BIT is 8. However, assumptions about eight-bit bytes are not universally portable. The exact-width unsigned type uint8_t, when provided, has exactly eight value bits and no padding bits; its availability is not required on every implementation.\n\nA language’s type named byte also need not have the same numerical interpretation as another language’s similarly named type. For example, such a type may be signed in one language and unsigned in another. This distinction affects arithmetic and conversion, even when the underlying storage contains eight bits in both cases.\n\nPrograms handling raw bytes must distinguish storage from interpretation. Converting a byte sequence into an integer, text string, or structured object requires rules governing such matters as byte order, encoding, and field boundaries."
    },
    {
      "heading": "Bytes and text",
      "text": "A byte is not equivalent to a character. Their relationship depends on the character encoding.\n\nASCII defines 128 codes and therefore requires seven bits per code; these codes are commonly stored in eight-bit bytes. Some other encodings assign one byte to each encoded character, but that relationship does not hold for text in general.\n\nUnicode assigns code points to characters and other textual elements. Its encoding forms represent those code points using different arrangements of storage units. In UTF-8, a Unicode scalar value occupies between one and four bytes. An ASCII letter occupies one byte, whereas many other characters require two, three, or four.\n\nA user-perceived character may also consist of several Unicode code points, such as a letter followed by a combining mark or an emoji sequence. Consequently, byte length, code-point count, and the number of visible characters can all differ.\n\nThis distinction matters in text storage, string processing, and protocol length fields. A limit expressed in bytes is not generally the same as a limit expressed in characters."
    },
    {
      "heading": "Units and prefixes",
      "text": "The customary symbol for byte is B. A lowercase b commonly denotes bit, although some standards and technical contexts use the explicit symbol bit. Capitalization is significant: MB and Mb ordinarily refer to different quantities.\n\nTwo prefix systems are used with bytes:\n\nDecimal unit | Bytes | Binary unit | Bytes\nkilobyte (kB) | \\(10^3 = 1{,}000\\) | kibibyte (KiB) | \\(2^{10} = 1{,}024\\)\nmegabyte (MB) | \\(10^6 = 1{,}000{,}000\\) | mebibyte (MiB) | \\(2^{20} = 1{,}048{,}576\\)\ngigabyte (GB) | \\(10^9 = 1{,}000{,}000{,}000\\) | gibibyte (GiB) | \\(2^{30} = 1{,}073{,}741{,}824\\)\nterabyte (TB) | \\(10^{12} = 1{,}000{,}000{,}000{,}000\\) | tebibyte (TiB) | \\(2^{40} = 1{,}099{,}511{,}627{,}776\\)\n\nDecimal prefixes follow the powers-of-ten convention of the International System of Units, although the byte itself is not an SI unit. Binary prefixes distinguish powers of two explicitly.\n\nHistorically, labels such as kilobyte and megabyte were also used for binary quantities. This legacy usage persists in software interfaces and documentation. A device described as having 1 TB contains \\(10^{12}\\) bytes under decimal labeling, equivalent to approximately 931.3 GiB. A display that labels that binary quantity “GB” can make the device appear smaller without any bytes being absent. Formatting and reserved storage can reduce usable capacity separately.\n\nBytes per second and bits per second\n\nStorage throughput is often stated in bytes per second, while communication rates are frequently stated in bits per second. For eight-bit bytes,\n\n\\[1\\ \\text{MB/s} = 8\\ \\text{Mbit/s}\\]\n\nwhen both prefixes are decimal.\n\nA link rate of 100 Mbit/s therefore corresponds arithmetically to 12.5 MB/s, but application data throughput can be lower because of protocol overhead, contention, retransmissions, and other constraints."
    },
    {
      "heading": "Logical size and physical storage",
      "text": "Byte counts measure different things depending on context. A file’s logical length is not necessarily its physical storage allocation. A file system usually allocates space in larger units, and small files may occupy more allocated space than their contents require. Sparse files can have a large logical length while using relatively little physical storage.\n\nCompression can represent the same logical content using fewer stored bytes, while metadata, redundancy, and error-correcting codes can require additional storage. Likewise, the physical implementation of an eight-bit logical byte may involve more than eight stored bits.\n\nA byte count alone therefore does not establish the amount of meaningful content, the number of visible text characters, the physical resources consumed, or the time required to transfer the data."
    }
  ],
  "links": [
    "bit",
    "computer",
    "hexadecimal",
    "ascii",
    "ibm",
    "central-processing-unit",
    "memory-hierarchy",
    "data-structure",
    "programming-language",
    "c-programming-language",
    "character-encoding",
    "unicode",
    "utf-eight",
    "international-system-of-units",
    "file-system",
    "data-compression",
    "error-correcting-code"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}