October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

Maximum Value of a Binary Number: Formula, Examples, and Integer Limits

An n-bit unsigned binary integer has a maximum of 2^n − 1; for a signed two’s-complement integer, it is 2^(n−1) − 1.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The maximum value of an n-bit binary integer depends on whether it is unsigned or signed. An unsigned integer tops out at 2n − 1; an n-bit signed two’s-complement integer tops out at 2n−1 − 1.

How do you calculate the maximum value?

For an unsigned integer with n bits, the maximum is 2n − 1. Each bit can be 0 or 1, and the largest possible pattern sets every bit to 1. The bit positions have weights 1, 2, 4, and so on through 2n−1; adding those weights gives 2n − 1.

As an Amazon Associate I earn from qualifying purchases.

The result is one less than the number of possible bit patterns because the values begin at zero. For example, 8 bits can encode 256 unsigned values, from 0 through 255.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes for a signed binary integer?

For an n-bit signed integer using two’s-complement representation, the maximum is 2n−1 − 1. Its full range is −2n−1 through 2n−1 − 1, inclusive. One bit participates in the sign representation, leaving n − 1 bits for the positive side.

This range is asymmetric: the minimum is one greater in magnitude than the maximum. For an 8-bit signed value, for instance, the range is −128 through 127, not −127 through 127.

Examples by bit width and signedness

Integer type Maximum value
8-bit unsigned 255
16-bit unsigned 65,535
32-bit signed, two’s complement 2,147,483,647
32-bit unsigned 4,294,967,295

The two 32-bit examples show why “32-bit” alone does not determine a maximum: signedness changes the range.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to find the limit for a programming type

Use the limit defined for the exact type rather than inferring width from a name. Language and platform conventions can differ; for example, GNU’s C manual notes that the width of long int depends on the system.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For exact-width integer limits, POSIX defines unsigned maxima as 2N − 1 and signed maxima as 2N−1 − 1: POSIX stdint.h definitions.

What to check when comparing integer limits

  • Bit width: the number of bits used to store the integer.
  • Signedness and representation: unsigned values are nonnegative; the signed formula here assumes two’s complement.
  • Actual language type: confirm its documented width and limit, especially for types whose width can vary by platform.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.