Lookup-table decoding is fast and distance preserving, making it attractive for near-term quantum computer architectures with small-distance quantum error-correcting codes. In this work, we develop several optimization tools that can potentially reduce the space and time overhead required for flag fault-tolerant quantum error correction (FTQEC) with lookup-table decoding on Calderbank-Shor-Steane (CSS) codes. Our techniques include the compact lookup-table construction, the meet-in-the-middle technique, the adaptive time decoding for flag FTQEC, the classical processing technique for flag information, and the separate X- and Z-counting technique. We evaluate the performance of our tools using numerical simulation of hexagonal color codes of distances 3, 5, 7, and 9 under circuit-level noise. Combining all tools can result in an increase of more than an order of magnitude in the pseudothreshold for the hexagonal color code of distance 9, from (1.34±0.01)×10−4 to (1.43±0.07)×10−3. Published by the American Physical Society 2024