20

I'm getting mixed answers on this question. For example, this source says addresses vary between 27 and 34 characters in length. The Wiki says 26-35 characters. Neither source cites something that will let me independently confirm the figures.

What are the minimum and maximum lengths of a Bitcoin address on mainnet, and how are these numbers derived?

0

3 Answers 3

21

The wiki is correct! The source you linked must have assumed that the address with the smallest encoding has version_byte=00, data=20*00, checksum=94A00911

$ encodeBase58 00000000000000000000000000000000000000000094A00911
1111111111111111111114oLvT2

Which has length 27. This address is valid and has been used on the blockchain! But it is not the shortest address.

I wrote this short bash script to find the minimum length address. It found that there were a total of 266 address of length 26. For anyone who is curious, these are the 266 addresses with length 26.


The maximum length address has version_byte=00, data=20*FF, checksum=FA06820B:

$ encodeBase58 00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA06820B
1QLbz7JHiBTspS962RLKV8GndWFwi5j6Qr

Which has length 34. This has also been used to receive coins, as can be seen here.

2
  • 5
    Note that this answer is out of date, since there have both been longer and shorter addresses seen on the network since it was written. Notably, p2wsh addresses are 62 characters.
    – Murch
    Jul 2, 2020 at 0:46
  • According to BIP 173: "Version 0 witness addresses are always 42 or 62 characters." So bc1 prefixed addresses would adhere to this limit Version 1 addresses (P2TR or Pay-To-Taproot) with a prefix bc1p are not strictly Version 0 witness addresses... however there is no mention of address length in BIP341... so not sure what the length here would be...
    – otech47
    Nov 22, 2022 at 17:11
6

The wiki says that

A Bitcoin address is an identifier of 26-35 alphanumeric characters.

This information is now outdated but it was true at the time this question was asked look at morsecoder's answer. With the introduction of Bech32 type addresses in 2017, the minimum and maximum length of a Bitcoin address have changed.

According to BIP 173:

[Segwit] addresses are always between 14 and 74 characters long.

Version 0 witness addresses are always 42 or 62 characters.

1

Private key and public key has a fixed size. Private keys are always 32 bytes, and public keys are always 65 bytes. However the bitcoin addresses are generated from the public key using Base58 encoding
Base58 generates a 35 characters address but as mentioned in the link and leading zero bytes are expressed as a single "1".

repeat(number_of_leading_zero_bytes_in_hash)
   {
   output_string.append(code_string[0]);
   }

Depending on the number of leading zeros, the minimum number can be different. Theoretically it even can be as small as 20 characters so you cant define the minimum length for the bitcoin addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.