Well if we're talking strictly integers, javascript as a constant you can use. Number.MAX_SAFE_INTEGER, which is equal to 2^53 - 1, or 9007199254740991, which is the highest integer javascript can represent "exactly". However, bitshifting is limited to 32bits, so to be really safe, you should stay in the 2^32 - 1 range, which is quite enough to be frank !