Byte Byte (symbol: B) is a basic unit of [1]information, nowadays already practically always consisting of 8 [2]bits (for which it's also called an octet), that allow it to store 2^8 = 256 distinct values (for example a number in range 0 to 255). It is commonly the smallest unit of computer memory a [3]CPU is able to operate on; memory addresses are assigned by steps of one byte. We use bytes to measure the size of [4]memory and derive higher memory [5]units such as a kilobyte (kB, 1000 bytes), kibibyte (KiB, 1024 bytes), megabyte (MB, 10^6 bytes) and so forth. In conventional [6]programming a one byte [7]variable is seen as very small and used if we are really limited by memory constraints (e.g. [8]embedded) or to mimic older 8bit computers ("[9]retro games" etc.): one byte can be used to store very small numbers (while in mainstream processors numbers nowadays mostly have 4 or 8 bytes), text characters ([10]ASCII, ...), very primitive [11]colors (see [12]RGB332, [13]palettes, ...) etc. Historically byte was used to stand for the basic addressable unit of memory capable of storing one text character or another "basic value" and could therefore have a different size than 8 bits: for example ASCII machines might have had a 7bit byte, 16bit machines a 16bit byte etc.; in [14]C (standard 99) char is the "byte" data type, its byte size is always 1 (sizeof(char) == 1), though its number of bits (CHAR_BIT) can be greater or equal to 8; if you need an exact 8bit byte use types such as int8_t and uint8_t from the standard stdint library. From now on we will implicitly talk about 8bit bytes. Value of one byte can be written exactly with two [15]hexadecimal digits with each digit always corresponding to higher/lower 4 bits, making mental conversions very easy; this is very convenient compared to [16]decimal representation, so programmers prefer to write byte values in hexadecimal. For example a byte whose binary value is 11010010 is D2 in hexadecimal (1101 is always D and 0010 is always 2), while in decimal we get 210. Byte frequency/probability: it may be [17]interesting and/or useful (e.g. for [18]compression) to know how often different byte values appear in the data we process with computers -- indeed, this always DEPENDS; if we are working with plain [19]ASCII text, we will never encounter values above 127, and on the other hand if we are processing photos from a polar expedition, we will likely mostly encounter byte values of 255 (as snow will cause most pixels to be completely white). In general we may expect values such as [20]0, 255, [21]1 and [22]2 to be most frequent, as many times these are e.g. assigned special meanings in data encodings, they may be cutoff values etc. Here is a table of measured byte frequencies in real data: { Measured by me. ~drummyfish } type of data least c. 2nd least 3rd least 3rd 2nd most most c. c. c. most c. c. GNU/Linux x86 0x9e (0%) 0xb2 (0%) 0x9a (0%) 0x48 0xff 0x00 executable (2%) (3%) (32%) bare metal ARM 0xcf (0%) 0xb7 (0%) 0xa7 (0%) 0xff 0x01 0x00 executable (2%) (3%) (15%) UTF8 English txt 0x00 (0%) 0x01 (0%) 0x02 (0%) 0x74 0x65 (e, 0x20 ( , book (t, 6%) 8%) 14%) C source code 0x00 (0%) 0x01 (0%) 0x02 (0%) 0x31 0x20 ( 0x2c (,, (1, 6%) , 12%) 16%) raw 24bit RGB 0x07 (0%) 0x09 (0%) 0x08 (0%) 0xdd 0x00 0xff photo image (0%) (1%) (25%) Links: 1. information.md 2. bit.md 3. cpu.md 4. memory.md 5. memory_units.md 6. programming.md 7. variable.md 8. embedded.md 9. retro.md 10. ascii.md 11. color.md 12. rgb332.md 13. palette.md 14. c.md 15. hexadecimal.md 16. decimal.md 17. interesting.md 18. compression.md 19. ascii.md 20. zero.md 21. one.md 22. two.md