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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store