How many (or up to how many) characters does a Ethereum address have?


I have been looking online for an answer but it seemed harder to find than I expected.

I am working on storing a list of Ethereum addresses with web3.js in a MySQL database, and need to know the limit of characters I should put for the VARCHAR. I could ofcourse put a very high value like 100 and be safe from not having enough space, however that would cost some speed.

  • If you just need to store the raw address, @jeff's answer below is correct. If you're looking to store ways of referring to Ethereum accounts, you may want to ensure that your table supports things like the Ethereum name service (ENS). While ENS does map things to addresses that can be expressed using 40-character hex strings by hashing them, you may want to store the pre-hashed values which can be arbitrarily long and can be unicoded. You'll still want to put a character limit on your column, but you'll want to at least set an encoding for the column to support unicode. – lungj Jul 14 '17 at 3:05

Ethereum addresses are often represented as 40-character hexadecimal strings. If you want to save with the hex prefix ("0x"), 42 characters should be enough.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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