Is there an easy way to validate an Ethereum address in C#?

Basically, I am looking for the method that correspond to these ones in Javascript but in C#.

1 Answer 1


In C#, you can use this method from the Nethereum NuGet package:

/// <summary>
/// Validates if the hex string is 40 alphanumeric characters
/// </summary>
public bool IsValidEthereumAddressHexFormat(string address)
    if (string.IsNullOrEmpty(address)) return false;
    return address.HasHexPrefix() && IsValidAddressLength(address) &&

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.