This paper presents flexible storage codes, a class of error-correcting codes that can recover information from a flexible number of storage nodes. As a result, one can make better use of the available storage nodes in the presence of unpredictable node failures and reduce the data access latency. Assume a storage system encodes kℓ information symbols over a finite field F into n nodes, each of size ℓ symbols. The code is parameterized by a set of tuples {(Rj, ℓj) : 1 ≤ j ≤ a}, satisfying ℓ1 < ℓ2 < < ℓa = ℓ and R1 > R2 > > Ra, such that the information symbols can be reconstructed from any Rj nodes, each node accessing ℓj symbols, for any 1 ≤ j ≤ a. In other words, the code allows a flexible number of nodes for decoding to accommodate the variance in the data access time of the nodes. Code constructions are presented for different storage scenarios, including LRC (locally recoverable) codes, PMDS (partial MDS) codes, and MSR (minimum storage regenerating) codes. We analyze the latency of accessing information and perform simulations on Amazon clusters to show the efficiency of the presented codes.