There are many types of Bitcoin addresses. Your example specifies (legacy) pay-to-pubkey-hash (P2PKH) address defined by Base58 check encoding and Wallet Import Format (WIF) which is also specified by base58 check
Base58 encoding treats the entire input payload as a big-endian big integer. Consider these alternate examples:
bc in ASCII:
0x62 0x63 (2 bytes) interpreted as a 2-byte int and encoded without leading zeros...
110001001100011 (15 characters)
25187 (5 characters)
6263 (4 characters)
8VG (3 characters)
So going forwards we know that for this example it took 3 base58 characters to encode two bytes. Lets run it backwards and try minimum and maximum values:
base 58, maximum value with 3 characters
zzz encodes three byte value:
base 58, minimum value with 3 characters
211 encodes two byte value:
From this example alone we discover that we can not determine the length in bytes of the original value based just on the length in characters of the encoded string.
Modern addresses are now encoded with bech32 and represent Segregated Witness programs. The bech32 spec is defined in BIP173 and look like this:
bech32 encoding does not use interpretation as big integers and instead maps input bytes more directly to output characters:
The data-part values:
- 1 byte: the witness version
- A conversion of the 2-to-40-byte witness program (as defined by BIP141) to base32:
- Start with the bits of the witness program, most significant bit per byte first.
- Re-arrange those bits into groups of 5, and pad with zeroes at the end if needed.
- Translate those bits to characters using the table above.
As a result of the previous rules, addresses are always between 14 and
74 characters long, and their length modulo 8 cannot be 0, 3, or 5.
Version 0 witness addresses are always 42 or 62 characters, but
implementations MUST allow the use of any version.
So in summary, with a bech32 address you can determine the length in bytes of the input value based on the length in characters of the encoded string:
In bech32, each character represents 5 bits