# Bit numbering and bit order

> Every bit of a value with its weight and its number under LSB 0, MSB 0 and 1-based numbering, the field you name as bits i to j, the value bit-reversed and in the order a link sends it, a printed bit string read in the order it was printed, and a MAC address in canonical and bit-reversed form, with the I/G and U/L bits named. Layouts for the LACP state, the TCP flags, the DNS flags, the ToS octet and the 802.1Q tag.

- Tool: https://ronutz.com/en/tools/bit-numbering-and-order
- Family: Networking

---

## What it does

Every bit of a binary number has a weight, and documents disagree about what to call each one. The least significant bit (LSB) is the one worth 1, the most significant bit (MSB) the one worth the most, and the three numberings in use count from different ends or from a different first number. The page answers the questions that follow, in three modes:

- **Value.** A number and its width: every bit with its weight and its number under LSB 0, MSB 0 and 1-based numbering, the set bits under each, the count of ones and the parity bit, the lowest and highest set bits, the two's complement reading, the value with its bits reversed, octet by octet and whole, the octets swapped, and the order the bits take on a link that sends the least significant bit first and on one that sends the most significant first. Optionally a known layout names every field, and "bits i to j" in any numbering gives the field's mask, shift and value.
- **Printed bits.** A string of 0s and 1s as a device printed it, with the order it was printed in: the value it stands for, and the value the same string gives if it is read the other way.
- **MAC address.** A 48-bit Media Access Control (MAC) address written in canonical form or bit-reversed: both forms, the I/G (individual/group) and U/L (universal/local) bits, the quadrant of a local address under the Structured Local Address Plan (SLAP), and the 48 bits in the order an Ethernet link sends them.

Everything is computed in your browser.

## The three numberings

- **LSB 0**: bit 0 is the least significant, so bit k is worth 2 to the power k. Intel's manual puts it in one sentence: "Bit positions are numbered from right to left. The numerical value of a set bit is equal to two raised to the power of the bit position" ([Intel SDM volume 1](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf), 1.3.1). The Linux kernel writes masks the same way, `BIT(nr)` as `1 << nr` and `GENMASK(h, l)` as "a contiguous bitmask starting at bit position @l and ending at position @h" ([include/linux/bits.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h)).
- **MSB 0**: bit 0 is the most significant. Every RFC (Request for Comments) diagram uses it: "the bit labeled 0 is the most significant bit", so the octet drawn `1 0 1 0 1 0 1 0` is 170 ([RFC 791](https://www.rfc-editor.org/rfc/rfc791.txt), Appendix B). IBM's z/Architecture numbers its registers this way too: in 24-bit addressing mode "bits 0-39 of the intermediate value are ignored" ([IBM SA22-7832-13](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf)).
- **1-based**: bit 1 is the least significant. The Simple Network Management Protocol (SNMP) places a BITS value in "bits 8 (high order bit) to 1 (low order bit)" of each octet ([RFC 3417](https://www.rfc-editor.org/rfc/rfc3417.txt), section 8), and Huawei's `display eth-trunk` documents its LACP PortState as Bit 1 to Bit 8 ([Huawei, Link Aggregation Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands)).

In a width of w bits, LSB 0 bit k is MSB 0 bit w - 1 - k and 1-based bit k + 1. The page shows all three for every bit, so a number read from one document can be found in another.

## Value: the inputs

- **Value**: hexadecimal with `0x` (`0x3D`), binary with `0b` (`0b0011_1101`), or decimal digits (`61`); single spaces or underscores may separate groups of digits. A minus sign before a decimal gives its two's complement bits. A string of hex digits without `0x` is refused with a hint, so `10` is never silently ten or sixteen.
- **Width**: 1 to 64 bits. Left blank, it comes from the input: four bits for each hexadecimal digit and one for each binary digit, leading zeros included (so `0x0800` is 16 bits), or the smallest of 8, 16, 32 and 64 that holds a decimal value.
- **Layout** (optional), for a value of the layout's width:
  - **LACP state** (8 bits): the Actor_State or Partner_State octet of the Link Aggregation Control Protocol (LACP). The Institute of Electrical and Electronics Engineers (IEEE) standard 802.1AX numbers the bits 0 (LACP_Activity) to 7 (Expired) ([IEEE8023-LAG-MIB](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib)), the Linux driver's masks run from `0x1` to `0x80` ([if_bonding.h](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h)), and Huawei prints the same bits as Bit 1 to Bit 8.
  - **MAC first octet** (8 bits): "The least significant bit of Octet 0 (the I/G bit)" and "the second least significant bit of Octet 0 (the U/L bit)" ([IEEE RA guidelines](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID)), with the Y and Z bits that [RFC 9542](https://www.rfc-editor.org/rfc/rfc9542.txt) draws above them (section 2.1).
  - **TCP flags** (8 bits): the header's fourteenth octet, CWR, ECE, URG, ACK, PSH, RST, SYN, FIN ([RFC 9293](https://www.rfc-editor.org/rfc/rfc9293.txt), section 3.1). The Internet Assigned Numbers Authority (IANA) numbers them 8 to 15 in its TCP Header Flags registry ([IANA](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml)), Linux `BIT(7)` to `BIT(0)` ([include/net/tcp.h](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h)).
  - **DNS flags** (16 bits): the second word of the Domain Name System (DNS) header, QR, Opcode, AA, TC, RD, RA, Z, AD, CD and RCODE as [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.txt) (section 4.1.1) and [RFC 6895](https://www.rfc-editor.org/rfc/rfc6895.txt) (section 2) draw them; IANA's DNS Header Flags registry numbers AA bit 5 to CD bit 11 ([IANA](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml)).
  - **IPv4 ToS** (8 bits): the Type of Service octet, the IPv6 Traffic Class: the differentiated services codepoint (DSCP) in bits 0 to 5 ([RFC 2474](https://www.rfc-editor.org/rfc/rfc2474.txt), section 3) and Explicit Congestion Notification (ECN) in "Bits 6 and 7" ([RFC 3168](https://www.rfc-editor.org/rfc/rfc3168.txt), section 5), with the ECN codepoint named.
  - **802.1Q TCI** (16 bits): the tag's priority, DEI (Drop Eligible Indicator) and VLAN (virtual local area network) ID, with the Linux kernel's masks `0xe000` (shift 13), `0x1000` and `0x0fff` ([include/linux/if_vlan.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h)).
- **Bits i to j** (optional): a numbering and one or two bit numbers. The field's mask, shift, value, the C expression `(v >> shift) & mask` and the kernel's `GENMASK(hi, lo)` (or `BIT(n)` for one bit), and the same bits under the other two numberings.

## Value: the rules

- **Two's complement.** The value read as a signed number is negative when its top bit is set; for 8, 16, 32 and 64 bits Intel's sentence applies: "The sign bit is located in bit 7 in a byte integer, bit 15 in a word integer, bit 31 in a doubleword integer, and bit 63 in a quadword integer" (Intel SDM, 4.2.1.2).
- **Lowest and highest set bit.** In LSB 0 numbers, what Intel's BSF and BSR instructions return: "the offset from the least significant bit (bit 0) in the bit string to the first set bit" (7.3.7.2).
- **Parity.** Even parity adds the bit that makes "an even number of logic 1s in the data and parity bits", odd parity the bit that makes it odd ([TI TL16C550D](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf), line control register bit 4).
- **Reversal.** "All bits reversed" mirrors the whole width; "Bits reversed in each octet" mirrors each octet in place, the swap [RFC 2469](https://www.rfc-editor.org/rfc/rfc2469.txt) describes between canonical and Token Ring addresses; "Octets swapped" is byte order, which [Big-endian and little-endian](https://ronutz.com/en/learn/big-endian-and-little-endian) explains. Mirroring the whole width is the other two together. The Linux kernel's own CRC-32, a cyclic redundancy check (CRC), shows a reversal: the same polynomial is `0x04c11db7` most significant bit first and `0xedb88320` least significant bit first ([include/linux/crc32.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h)).
- **On the wire.** For whole octets, the bits in the order a link sends them, octet by octet, the octets in the order written (most significant first, as network byte order sends a number, RFC 791). Least significant bit first is Ethernet's order, the reverse of what the Internet Engineering Task Force (IETF) draws: "the physical order of bit transmission within an octet on an IEEE [802.3] link is from the lowest order bit to the highest order bit (i.e., the reverse of the IETF's ordering)" (RFC 9542, section 1.1); a UART (universal asynchronous receiver-transmitter) does the same, "Bit 0 is the least significant bit. It is the first bit serially transmitted or received" (TI TL16C550D), and the Point-to-Point Protocol (PPP): "All octets are transmitted least significant bit first" ([RFC 1662](https://www.rfc-editor.org/rfc/rfc1662.txt), sections 4.5.2 and 5.5). Most significant bit first is the rule of an I2C bus, "Data is transferred with the Most Significant Bit (MSB) first" ([NXP UM10204](https://www.nxp.com/docs/en/user-guide/UM10204.pdf), 3.1.5), and the default of a Serial Peripheral Interface (SPI) bus, "the 'MSB first' default for each word in a transfer", which a device can change with `SPI_LSB_FIRST` ([include/linux/spi/spi.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h)).

## Printed bits

Type the bits in the order they are printed and say which end comes first. **Most significant bit first** is the order numbers are written in. **Least significant bit first** is how Huawei prints an LACP PortState: its command reference describes "The status variable is eight bits, such as 10111100" as Bit 1 to Bit 8, in the order of 802.1AX's bits 0 to 7, so its first character is LACP_Activity, the bit of weight 1, and `10111100` is the octet 0x3D (Huawei, Table 5-17). Read the other way, the same string would be 0xBC, and the page shows both, because a misread order changes the number without any error. The value's whole reading follows, with the LACP state layout if you choose it.

## MAC address

- **Canonical form** is how [RFC 2469](https://www.rfc-editor.org/rfc/rfc2469.txt) defines an address for display: "The first bit of each byte that appears on the LAN maps to the least significant (i.e., right-most) bit of each byte in memory", which "puts the group address indicator ... in the least significant bit of the first byte". Ethernet hardware works this way.
- **Bit-reversed form** ("MSB format", "non-canonical form") is how Token Ring and some FDDI (Fiber Distributed Data Interface) adapters held addresses: each octet with its bits reversed, so 12-34-56-78-9A-BC sat in memory as 48-2C-6A-1E-59-3D. Choose the form the address was written in; the page gives the other.
- **I/G and U/L.** From the canonical first octet: I/G 0 for one station, 1 for a group (multicast or broadcast); U/L 0 for an address under an IEEE-assigned prefix, 1 for a local one (IEEE RA guidelines; RFC 9542). The Linux kernel tests them as `0x01 & addr[0]` and `0x02 & addr[0]` ([include/linux/etherdevice.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h)).
- **SLAP quadrant.** For a local address, the Y and Z bits pick one of four quadrants: Administratively Assigned (Y 0, Z 0), Extended Local (Y 0, Z 1), Reserved (Y 1, Z 0) and Standard Assigned (Y 1, Z 1) (RFC 9542, section 2.1.1, Table 2); the plan is optional.
- **On the wire.** The 48 bits octet by octet, each least significant bit first, so the first bit sent is the I/G bit.
- **The misread line** shows what a reader who took the bit-reversed form for the canonical one would conclude about I/G and U/L. RFC 2469 records the practical result: bridges between Token Ring and Ethernet had to "perform bit swaps of the addresses in the address fields of ARP packets", the Address Resolution Protocol's (section 3.2).

## What it refuses, and why

A field longer than 80 characters; an empty field; hexadecimal without `0x` (with a hint), a prefix whose digits do not follow it, octal, a MAC address in value mode (it points to MAC mode); a value of more than 64 bits; a width outside 1 to 64 or a value that does not fit its width (with the bits it needs), and a negative decimal outside the width's two's complement range; an unknown layout, numbering, printed order or MAC form; a layout of another width than the value (with the width to set); a bit number that is not a whole number or does not exist in the width for the chosen numbering (with the range); a last bit without a first; a printed string with anything but 0s, 1s and single separators; and a MAC address that is not six octets in one of the four forms.

## Worked examples

- **The DNS answer flags 0x81A0** (the Example, from the Learn article on the DNS header): read as the DNS flags, QR, RD, RA and AD are set. QR is MSB 0 bit 0 and LSB 0 bit 15; RD, which IANA numbers bit 7, is LSB 0 bit 8.
- **Huawei's PortState 10111100** (the printed-bits Example), least significant bit first: 0x3D, LACP_Activity, Aggregation, Synchronization, Collecting and Distributing set; misread most significant bit first it is 0xBC. The samples 10100000 and 10110000 are 0x05 and 0x0D.
- **Cisco's "0111101 (binary)"**: Cisco's EtherChannel troubleshooting document gives "The expected value for LACP flags is 0x3D (hex) or 0111101 (binary)" ([Cisco, document 220367](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html)). Typed as `0b0111101`, those seven digits are a 7-bit value, and the 8-bit LACP layout refuses it; with the width set to 8 the dropped leading zero comes back and the value is 0x3D, the same octet Huawei prints as 10111100.
- **RFC 2469's address** (the MAC Example): 12-34-56-78-9A-BC is local (U/L 1) and individual, Administratively Assigned under the SLAP, and 48-2C-6A-1E-59-3D bit-reversed; read as canonical, that reversed form would look universal.
- **DSCP from ToS 0xB8**: MSB 0 bits 0 to 5 are LSB 0 bits 7 to 2, `GENMASK(7, 2)`, mask 0xFC, shift 2, value 46.
- **The CRC-32 polynomial 0x04C11DB7** bit-reversed is 0xEDB88320, the kernel's two forms of the same polynomial; RFC 1662's FCS-16 constant 0x8408 reversed is 0x1021.

## What it does not do

It reads values and addresses you type; it does not capture traffic or talk to any device. It does not compute checksums or CRCs, convert byte order beyond showing the swapped octets, decode whole headers (the [802.1Q tag decoder](https://ronutz.com/en/tools/vlan-tag-and-trunk-calculator), the [LACP member link and state reader](https://ronutz.com/en/tools/lacp-hash-and-state-reader) and the DNS tools do), or name a MAC address's vendor (the [OUI lookup](https://ronutz.com/en/tools/oui-lookup) does).

## Share results

Under the headline, **Share results** builds a link to this page, only when you press it, that carries the field as typed and the mode's own settings, after the `#`: `input` and `mode` (`value`, `printed` or `mac`) always; in value mode `width` when typed, `layout` when one is chosen, and `numbering`, `from` and `to` (when typed) for a field; in printed mode `order`, `layout` and the field as in value mode; in MAC mode `form`. The other modes' settings are not carried.

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986.txt) (section 3.5, read 2026-11-08) has the fragment "separated from the rest of the URI prior to a dereference", so these values are not sent to the server when the link is opened; they stay in the address bar and the history of whoever opens it, and anyone who has the link can read them.

- **How long.** A link carries at most 16,384 characters, the bound the site uses for every value after the `#`; these fields are far shorter.
- **Opening a link.** The mode and its settings are set as typing would set them, the other modes keep their values, and the page computes. A link with an unknown mode, layout, order, form or numbering, a setting of another mode, a width or bit number that is not one to three digits, a `to` without a `from`, a numbering without a `from`, or a field over one line or longer than 80 characters is ignored. Accepted or not, the values then leave the page's own address at once, without a request, so a reload, a bookmark or the page's own Share button carries nothing you did not choose to share.

## Provenance

The engine is fixed bit arithmetic on BigInt values, with no clock, no network and no randomness. Its golden vectors (set `bit-numbering-and-order-golden-2026-11-08`) pin all 256 octets in value mode and printed least significant bit first, widths from 1 to 64 (all ones and the top bit alone), width inference from hexadecimal, binary and decimal, negative decimals, every layout on several values, fields in all three numberings including the kernel's own `GENMASK_ULL(39, 21)` example, printed strings in both orders with separators, MAC addresses in every form and SLAP quadrant, the Examples and samples, the sentences that carry the rules, the API texts and the refusals. Every expected value was computed by a separate Python model written from the documents (bits as text, positions as string indexes, reversal by reversing the text, octets by `int.to_bytes`), not by running this engine.

## API

The same engine answers `/api/v1/bit-numbering-and-order` on the site's HTTP API; the contract is on the [API page](https://ronutz.com/en/api), which also says whether this site serves the API.

- **Request.** A JSON object. Value: `{"mode": "value", "input": "0x81A0", "width": 16, "layout": "dns-flags", "numbering": "msb0", "from": 1, "to": 4}`; `width`, `layout`, `numbering`, `from` and `to` are optional. Printed: `{"mode": "printed", "input": "10111100", "order": "lsb-first", "layout": "lacp"}`; `order` (`msb-first` by default) and the rest are optional. MAC: `{"mode": "mac", "input": "48-2C-6A-1E-59-3D", "form": "reversed"}`; `form` (`canonical` by default) is optional.
- **Response, value and printed.** `mode`, `width`, `widthInferred`, `hex`, `decimal`, `signed`, `binary`, `binaryLsbFirst`, `octets`, `bits` (each `lsb0`, `msb0`, `one`, `weight`, `set`), `setBits` (`lsb0`, `msb0`, `one`), `ones`, `parityEven`, `parityOdd`, `lowestSet`, `highestSet`, `reversed`, `reversedPerOctet`, `byteSwapped`, `wire` (`lsbFirst`, `msbFirst`), `printed` (`order`, `typed`, `otherHex`, `otherDecimal`, or null), `layout` (`id`, `width`, `fields`, `numberingNote`, or null), `field` (`numbering`, `from`, `to`, `lsb0Hi`, `lsb0Lo`, `msb0From`, `msb0To`, `oneHi`, `oneLo`, `span`, `mask`, `shift`, `value`, `valueHex`, `bits`, `expression`, `kernel`, or null) and `notes`.
- **Response, MAC.** `mode`, `form`, `formDefault`, `canonical`, `canonicalColon`, `reversed`, `firstOctetBits`, `group`, `local`, `broadcast`, `slap` (`y`, `z`, `quadrant`, `name`, or null), `wire`, `firstBitOnWire`, `reversedMisread` (`group`, `local`) and `notes`.
- **Errors.** HTTP 400, `invalid_input`, with the engine's message, for example `"3D" looks hexadecimal: write it with 0x in front (0x3D), so it is not read as decimal.`.

## Sources

- [Intel 64 and IA-32 Architectures Software Developer's Manual, volume 1, 253665-084US, June 2024](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf) (read 2026-11-08): 1.3.1, 4.2.1.2, 7.3.7
- [IBM z/Architecture Principles of Operation, SA22-7832-13, May 2022](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf) (read 2026-11-08): chapter 3
- [RFC 791, Internet Protocol](https://www.rfc-editor.org/rfc/rfc791.txt) (STD 5, read 2026-11-08): Appendix B
- [RFC 1035, Domain Names: Implementation and Specification](https://www.rfc-editor.org/rfc/rfc1035.txt) (STD 13, read 2026-11-08): sections 2.3.2 and 4.1.1; [RFC 6895](https://www.rfc-editor.org/rfc/rfc6895.txt) (BCP 42, read 2026-11-08): section 2; [IANA, DNS Header Flags](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml) (updated 2026-10-16, read 2026-11-08)
- [RFC 3417, Transport Mappings for SNMP](https://www.rfc-editor.org/rfc/rfc3417.txt) (STD 62, read 2026-11-08): section 8
- [Huawei, S5700 and S6700 V200R025C00 Command Reference, Link Aggregation Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands) (read in a browser on 2026-11-08: the site refuses automated reads): display eth-trunk, Table 5-17
- [Cisco, Troubleshoot EtherChannels on Catalyst 9000 Switches, document 220367](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html) (updated 8 August 2024; read in a browser on 2026-11-08: the site refuses automated reads): the expected LACP flags
- [IEEE8023-LAG-MIB for IEEE 802.1AX-2020](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib) (read 2026-11-08) and the Linux kernel's [include/uapi/linux/if_bonding.h](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h) (read 2026-11-08)
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters](https://www.rfc-editor.org/rfc/rfc9542.txt) (BCP 141, read 2026-11-08): sections 1.1, 2.1, 2.1.1, 2.1.4 and 2.3.1
- [RFC 2469, A Caution On The Canonical Ordering Of Link-Layer Addresses](https://www.rfc-editor.org/rfc/rfc2469.txt) (Informational, read 2026-11-08): sections 2 and 3
- [IEEE Registration Authority, Guidelines for Use of EUI, OUI and CID](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID) (updated 1 April 2022, read 2026-11-08)
- [RFC 1662, PPP in HDLC-like Framing](https://www.rfc-editor.org/rfc/rfc1662.txt) (STD 51, read 2026-11-08): sections 3.1, 4.5.2, 5.5 and appendix C.1
- [Texas Instruments, TL16C550D](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf) (SLLS597E, read 2026-11-08)
- [NXP Semiconductors, UM10204 I2C-bus specification and user manual, Rev. 7.0, 1 October 2021](https://www.nxp.com/docs/en/user-guide/UM10204.pdf) (read in a browser on 2026-11-08: the site refuses automated reads): 3.1.5 Byte format, Figure 10
- The Linux kernel source, torvalds/linux master (read 2026-11-08): [include/linux/spi/spi.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h), [include/linux/bits.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h), [include/linux/crc32.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h), [include/linux/etherdevice.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h), [include/net/tcp.h](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h) and [include/linux/if_vlan.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h)
- [IANA, TCP Header Flags](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml) (updated 2026-10-22, read 2026-11-08) and [RFC 9293, Transmission Control Protocol](https://www.rfc-editor.org/rfc/rfc9293.txt) (STD 7, read 2026-11-08): section 3.1
- [RFC 2474, the DS Field](https://www.rfc-editor.org/rfc/rfc2474.txt) (read 2026-11-08): section 3; [RFC 3168, ECN](https://www.rfc-editor.org/rfc/rfc3168.txt) (read 2026-11-08): section 5
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986.txt) (STD 66, read 2026-11-08): section 3.5
- [RFC Editor, RFC index](https://www.rfc-editor.org/rfc-index.xml) (read 2026-11-08): the status of every RFC above

## Standards and references

- [Intel 64 and IA-32 Architectures Software Developer's Manual, volume 1, 253665-084US, June 2024: 1.3.1 Bit and Byte Order, 4.2.1.2 Signed Integers, 7.3.7 bit test and bit scan instructions](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf) - LSB 0: "Bit positions are numbered from right to left. The numerical value of a set bit is equal to two raised to the power of the bit position"; the sign bit in bit 7, 15, 31 or 63; BSF and BSR give "the offset from the least significant bit (bit 0)"
- [IBM z/Architecture Principles of Operation, SA22-7832-13, fourteenth edition, May 2022: chapter 3, information formats and operand addresses](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf) - MSB 0 in a processor manual: "bits are numbered in a left-to-right sequence", an address's "bits are numbered 0-63", and in 24-bit mode "bits 0-39 of the intermediate value are ignored"
- [RFC 791, Internet Protocol, September 1981 (STD 5): Appendix B, Data Transmission Order](https://www.rfc-editor.org/rfc/rfc791.txt) - "the bit labeled 0 is the most significant bit"; the octet drawn 1 0 1 0 1 0 1 0 is 170; the most significant octet of a multi-octet quantity is transmitted first
- [RFC 1035, Domain Names: Implementation and Specification, November 1987 (STD 13): sections 2.3.2 and 4.1.1](https://www.rfc-editor.org/rfc/rfc1035.txt) - the same transmission-order rule; the header's flags word QR, Opcode, AA, TC, RD, RA, Z and RCODE as drawn
- [RFC 6895, Domain Name System (DNS) IANA Considerations, April 2013 (BCP 42): section 2](https://www.rfc-editor.org/rfc/rfc6895.txt) - the header drawing with AD and CD in the place of RFC 1035's Z bits
- [IANA, Domain Name System (DNS) Parameters, DNS Header Flags (registry updated 2026-10-16)](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml) - AA bit 5, TC bit 6, RD bit 7, RA bit 8, bit 9 reserved, AD bit 10, CD bit 11 of the second 16-bit word (MSB 0)
- [RFC 3417, Transport Mappings for the Simple Network Management Protocol (SNMP), December 2002 (STD 62): section 8](https://www.rfc-editor.org/rfc/rfc3417.txt) - a BITS value is placed in "bits 8 (high order bit) to 1 (low order bit)" of each octet, first named bit first: 1-based numbering from the least significant bit
- [Huawei, S5700 and S6700 V200R025C00 Command Reference, Link Aggregation Commands: display eth-trunk and Table 5-17 PortState (read in a browser on 2026-11-08: the site refuses automated reads)](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands) - "The status variable is eight bits, such as 10111100", described as Bit 1 to Bit 8 in the order of 802.1AX's bits 0 to 7; the example rows 10111100, 10100000 and 10110000
- [Cisco, Troubleshoot EtherChannels on Catalyst 9000 Switches, document 220367, updated 8 August 2024 (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html) - "The expected value for LACP flags is 0x3D (hex) or 0111101 (binary)", seven binary digits as printed (0x3D is 00111101 in 8 bits); its state table labels Expired the most significant bit and LACP Activity the least
- [IEEE 802.1 Working Group, IEEE8023-LAG-MIB (IEEE 802.1AX-2020), revision 2020-05-29: LacpState and dot3adAggPortActorAdminState](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib) - LacpState BITS lacpActivity(0) to expired(7); "The first bit corresponds to bit 0 of the Actor_State (LACP_Activity)"
- [The Linux kernel source, include/uapi/linux/if_bonding.h (torvalds/linux master): LACP_STATE_* masks](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h) - LACP_STATE_LACP_ACTIVITY 0x1 to LACP_STATE_EXPIRED 0x80: 802.1AX's bit k is the bit of weight 2^k
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters, April 2024 (BCP 141): sections 1.1, 2.1, 2.1.1, 2.1.4 and 2.3.1](https://www.rfc-editor.org/rfc/rfc9542.txt) - bit transmission within an octet on an IEEE 802.3 link "from the lowest order bit to the highest order bit (i.e., the reverse of the IETF's ordering)"; the M, X, Y and Z bits of the first octet; the four SLAP quadrants; the documentation and 33-33 addresses of the samples
- [RFC 2469, A Caution On The Canonical Ordering Of Link-Layer Addresses, December 1998 (Informational): sections 2 and 3](https://www.rfc-editor.org/rfc/rfc2469.txt) - canonical form ("LSB format") against Token Ring's "MSB format"; 12-34-56-78-9A-BC held as 48-2C-6A-1E-59-3D; bridges that "perform bit swaps of the addresses" in ARP packets
- [IEEE Registration Authority, Guidelines for Use of Extended Unique Identifier (EUI), Organizationally Unique Identifier (OUI), and Company ID (CID), updated 1 April 2022](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID) - "The least significant bit of Octet 0 (the I/G bit)" and "the second least significant bit of Octet 0 (the U/L bit)"; EUI bit ordering, which "applications and protocols must unambiguously specify"
- [The Linux kernel source, include/linux/etherdevice.h (torvalds/linux master): is_multicast_ether_addr and is_local_ether_addr](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h) - the group test 0x01 & addr[0] and the local test 0x02 & addr[0] on the canonical address in memory
- [RFC 1662, PPP in HDLC-like Framing, July 1994 (STD 51): sections 3.1, 4.5.2, 5.5 and appendix C.1](https://www.rfc-editor.org/rfc/rfc1662.txt) - "All octets are transmitted least significant bit first"; binary numbers written most significant bit first, "contrary to standard ISO and CCITT practice which orders bits as transmitted"; the FCS-16 polynomial constant 0x8408
- [Texas Instruments, TL16C550D Asynchronous Communications Element with Autoflow Control, SLLS597E, revised December 2008](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf) - "Bit 0 is the least significant bit. It is the first bit serially transmitted or received"; even parity is "an even number of logic 1s in the data and parity bits"
- [NXP Semiconductors, UM10204 I2C-bus specification and user manual, Rev. 7.0, 1 October 2021: 3.1.5 Byte format and Figure 10 (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.nxp.com/docs/en/user-guide/UM10204.pdf) - "Data is transferred with the Most Significant Bit (MSB) first"; the first byte after START carries the target address from its most significant bit with the R/W bit as its least significant
- [The Linux kernel source, include/linux/spi/spi.h and include/uapi/linux/spi/spi.h (torvalds/linux master): spi_device mode, SPI_LSB_FIRST](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h) - the "MSB first" default for each word in a transfer, overridden by SPI_LSB_FIRST ("per-word bits-on-wire")
- [The Linux kernel source, include/vdso/bits.h and include/linux/bits.h (torvalds/linux master): BIT and GENMASK](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h) - BIT(nr) is (1 << nr); GENMASK(h, l) is "a contiguous bitmask starting at bit position @l and ending at position @h", and GENMASK_ULL(39, 21) is 0x000000ffffe00000
- [The Linux kernel source, include/linux/crc32.h (torvalds/linux master): crc32_le and crc32_be](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h) - the same CRC-32 polynomial least-significant-bit-first as 0xedb88320 and most-significant-bit-first as 0x04c11db7: one is the other bit-reversed
- [IANA, Transmission Control Protocol (TCP) Parameters, TCP Header Flags (registry updated 2026-10-22)](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml) - AE bit 7, CWR bit 8, ECE 9, URG 10, ACK 11, PSH 12, RST 13, SYN 14, FIN 15
- [The Linux kernel source, include/net/tcp.h (torvalds/linux master): TCPHDR_* flags](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h) - TCPHDR_FIN BIT(0) to TCPHDR_CWR BIT(7), TCPHDR_AE BIT(8)
- [RFC 9293, Transmission Control Protocol (TCP), August 2022 (STD 7): section 3.1, header format](https://www.rfc-editor.org/rfc/rfc9293.txt) - the control bits CWR, ECE, URG, ACK, PSH, RST, SYN and FIN in that order after the Data Offset and the reserved bits
- [RFC 2474, Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers, December 1998 (Proposed Standard, updated by RFC 3168, 3260 and 8436): section 3](https://www.rfc-editor.org/rfc/rfc2474.txt) - the DSCP in bits 0 to 5 of the DS field, "the left-most bit signifies bit 0"
- [RFC 3168, The Addition of Explicit Congestion Notification (ECN) to IP, September 2001 (Proposed Standard): section 5](https://www.rfc-editor.org/rfc/rfc3168.txt) - "Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field"; the codepoints Not-ECT, ECT(1), ECT(0) and CE
- [The Linux kernel source, include/linux/if_vlan.h (torvalds/linux master): VLAN_PRIO_MASK, VLAN_CFI_MASK and VLAN_VID_MASK](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h) - 0xe000 with shift 13 for the priority, 0x1000 "Canonical Format Indicator / Drop Eligible Indicator", 0x0fff for the VLAN ID
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, January 2005 (STD 66): section 3.5](https://www.rfc-editor.org/rfc/rfc3986.txt) - the fragment is "separated from the rest of the URI prior to a dereference": a Share results link's values are not sent to the server
- [RFC Editor, RFC index (XML): the current status of every RFC cited](https://www.rfc-editor.org/rfc-index.xml) - RFC 791, 1035, 1662, 3417, 9293 and 3986 are Internet Standards; RFC 9542 and 6895 are BCPs; RFC 2474 and 3168 Proposed Standards; RFC 2469 Informational; none obsoleted

## Related reading

- [Badges and cards: RFID, NFC, the Proxmark and MIFARE](https://ronutz.com/en/learn/badges-and-cards-rfid-nfc-the-proxmark-and-mifare.md): An office badge, a transit card and a car key's transponder are radio devices with no battery that answer whatever reader powers them. The cheap ones at 125 kHz answer with a bare number anyone can copy; the 13.56 MHz MIFARE Classic, the most deployed card of its kind, hid a weak cipher until researchers in Berlin and Nijmegen took it apart in 2007 and 2008, and its manufacturer lost a court bid to stop the publication. After reading, you can explain how passive cards are powered and which standards govern them, decode a 26-bit badge number, follow the Proxmark from Jonathan Westhues's bench to the Proxmark 5, read a MIFARE Classic authentication trace, date every major break from the car-key transponders of 2005 to the 2024 backdoor in compatible chips, see where Brazil's Bilhete Único and Brazilian law fit, and name the migrations and reader settings that actually defend a door.
- [Big-endian and little-endian: byte order explained](https://ronutz.com/en/learn/big-endian-and-little-endian.md): A number wider than one byte has to be laid out over several addresses, and machines disagree about which end goes first. What big-endian and little-endian mean, one 32-bit value byte by byte in both orders, where Danny Cohen found the names in 1980, why byte order is not bit order, network byte order in the RFCs and in POSIX, which processors are little-endian, big-endian or both, the instructions that swap bytes, the file formats and protocols that fix an order, what each order really costs, the bugs it causes, how to tell what a machine is, and three cases on this site: the LACP hash, the BIG-IP cookie and UTF-16.
- [Hiding in images: LSB, JPEG and adaptive steganography](https://ronutz.com/en/learn/hiding-in-images-lsb-jpeg-and-adaptive-steganography.md): Digital images became the favourite carrier for hidden messages because every pixel and every compressed coefficient is a number with a little noise in it. This part follows the techniques from the first least-significant-bit tools of the 1990s through palette tricks, JPEG coefficient embedding (JSteg, OutGuess, F5 and matrix embedding) to the content-adaptive schemes of the 2010s (HUGO, WOW, UNIWARD) and the syndrome-trellis codes that drive them. After reading, you can embed one byte into eight pixels by hand, explain why JPEG hiding works on quantized DCT coefficients, compute how matrix embedding saves changes, read a payload in bits per pixel critically, and name the open tools from their own documentation.
- [Least and most significant bit: bit numbering and bit order](https://ronutz.com/en/learn/least-and-most-significant-bit.md): Every bit of a binary number has a weight, and the least significant bit is worth 1 while the most significant bit is worth the most and, in two's complement, carries the sign. What significance means, why LSB and MSB sometimes mean bytes, the three ways documents number bits (LSB 0, MSB 0 and 1-based) and the same field read all three ways, the order bits travel on Ethernet, a UART, PPP, I2C and SPI, canonical and bit-reversed MAC addresses, masks, shifts, parity and reflected CRCs, the bugs a wrong order causes, and three cases on this site: Huawei's PortState printed bit 1 first, the I/G and U/L bits of a MAC address, and the DNS header flags.
- [Link aggregation and LACP: several links that act as one, and the protocol that keeps them honest](https://ronutz.com/en/learn/link-aggregation-and-lacp.md): A link aggregation group bundles parallel Ethernet links into one logical link for more bandwidth and for resilience. Where the standard came from (802.3ad, then 802.1AX), how LACP lets both ends agree before a single frame is sent, the fast and slow timers, why static bundles are risky, why one flow never goes faster than one member link, the rules members must follow, multi-chassis bundles, and the Linux bonding modes.
- [The DNS Header: Opcode, Status, and Flags](https://ronutz.com/en/learn/dns-message-header-and-flags.md): Every DNS message opens with the same 12-byte header: a 16-bit ID, a flags word that holds the opcode, seven named flags, a reserved bit and the response code, and four section counts, which dig prints as its header and flags lines. After reading, you can decode a header from its hexadecimal bytes, say what each flag, opcode and status tells a diagnosis, recognize a truncated answer and test the TCP retry it needs, and explain why the ID and the source port must be unpredictable.
- [The Ethernet frame, field by field: preamble to FCS, the 802.1Q tag, and the sizes that matter](https://ronutz.com/en/learn/the-ethernet-frame-field-by-field.md): Every Ethernet frame is the same short sequence of fields: a preamble to wake the receiver, two addresses, one field that is either a length or a type, the payload, and a checksum. What each field holds, why the minimum is 64 octets and the maximum 1518, where the 802.1Q tag goes and what it carries, and why jumbo frames are not in the standard.
- [The hardware hacker's bench: Bus Pirate, JTAG, UART and ChipWhisperer](https://ronutz.com/en/learn/the-hardware-hackers-bench-bus-pirate-jtag-uart-and-chipwhisperer.md): Every circuit board is built with doors for its makers: a serial console that prints the boot log, a Joint Test Action Group (JTAG) port defined by IEEE 1149.1 for testing and debugging, Arm's two-wire Serial Wire Debug, and the SPI and I2C buses where firmware and secrets are stored. This part explains what each interface is for and how it works, the tools that speak to them (the Bus Pirate, the JTAGulator, Saleae and sigrok logic analysers, Great Scott Gadgets' GreatFET, the Tigard, the Shikra and NewAE's ChipWhisperer), what power analysis and fault injection are, and how manufacturers lock the doors. After reading, you can read a UART settings line and a debug-header pin-out, decode a JTAG IDCODE down to the manufacturer, explain side-channel and glitch attacks in principle, retell four documented cases from their sources, and say which controls (readout protection, debug lockout, secure boot, tamper response) a product-security team should test.
- [What Is an OUI, and How MAC Addresses Are Assigned](https://ronutz.com/en/learn/what-is-an-oui.md): How a MAC address is structured, what the OUI (the manufacturer prefix) is and who hands it out, the difference between universally and locally administered addresses, and why a randomized Wi-Fi MAC has no vendor at all.
