Bitcoin Address Regular Expression

A regular expression to parse and validate Bitcoin addresses.

/^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$

What Is Bitcoin Address:

A Bitcoin address is a virtual location where the cryptocurrency can be sent. It is alphanumeric and always starts with a 1 or a 3.

Bitcoin Address Examples:

  • 1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY
  • bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq
  • 1EBHA1ckUWzNKN7BMfDwGTx6GKEbADUozX

Characters & constructs:

View Full Cheatsheet

expr usage
[ABCD] Matches any character in square brackets (case sensitive).
[a-z] Matches all lowercase letters (a to z).
[A-Z] Matches all uppercase letters (A to Z).
{25,39} Matches the specified quantity of the previous token. {25,39} will match 25 to 39. {25} will match exactly 25. {25,} will match 25 or more.