How to check if Ethereum address is valid or not

With web3.js, you can check if Ethereum address is valid or not.

Code Example

const address = "0x0089d53F703f7E0843953D48133f74cE247184c2"
let result = Web3.utils.isAddress(address)
console.log(result) // => true

Notes

  • Web3.utils.isAddress also checks the checksum, if address has upper and lowercase letters.
  • The function works without the0x prefix.

Working Demo

References

Support

If you find this article is helpful, it would be greatly appreciated if you could tip Ether to the address below. Thank you!

0x0089d53F703f7E0843953D48133f74cE247184c2
Like what you read? Give Hideyoshi Moriya a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.