Back to all patterns
Bitcoin Address (P2PKH, P2SH, Bech32)
Validation
Matches legacy (1...), P2SH (3...), and Bech32 (bc1...) Bitcoin addresses.
/^(?:[13][a-km-zA-HJ-NP-Z1-9]{25,34}|bc1[a-z0-9]{39,59})$/How it works
Three address formats are in active use: P2PKH starts with 1, P2SH starts with 3, and Bech32 (SegWit) starts with bc1. Each uses a distinct alphabet, note the exclusions in legacy (no 0, O, I, l).
Test Cases
Should Match
- 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
- 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy
- bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
Should NOT Match
- BC1qw508
- 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfN0
- abc
Quick Summary
Matches the three common Bitcoin address formats: legacy (1), P2SH (3), and Bech32 SegWit (bc1).