<!--
{
  "availability" : [
    "iOS: 16.4.0 -",
    "iPadOS: 16.4.0 -",
    "macCatalyst: 16.4.0 -",
    "macOS: 13.3.0 -",
    "tvOS: 16.4.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/StaticBigInt/bitWidth",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s12StaticBigIntV8bitWidthSivp"
  },
  "title" : "bitWidth"
}
-->

# bitWidth

Returns the minimal number of bits in this value’s binary representation,
including the sign bit, and excluding the sign extension.

```
var bitWidth: Int { get }
```

## Discussion

The following examples show the least significant byte of each value’s
binary representation, separated (by an underscore) into excluded and
included bits. Negative values are in two’s complement.

- `-4` (`0b11111_100`) is 3 bits.
- `-3` (`0b11111_101`) is 3 bits.
- `-2` (`0b111111_10`) is 2 bits.
- `-1` (`0b1111111_1`) is 1 bit.
- `+0` (`0b0000000_0`) is 1 bit.
- `+1` (`0b000000_01`) is 2 bits.
- `+2` (`0b00000_010`) is 3 bits.
- `+3` (`0b00000_011`) is 3 bits.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)