Abstract We show that for a fixed $q$ , the number of -ary $t$ -error correcting codes length $n$ is at most $2^{(1 + o(1)) H_q(n,t)}$ all $t \leq (1 - q^{-1})n 2\sqrt{n \log n}$ where $H_q(n, t) = q^n/ V_q(n,t)$ Hamming bound and $V_q(n,t)$ cardinality radius ball. This proves conjecture Balogh, Treglown, Wagner, who showed result o(n^{1/3} (\log n)^{-2/3})$ .