Metal–organic framework ZIF-8, from the zeolitic imidazolate framework family, shows a large intrinsic second-order nonlinear optical (NLO) response. In addition, ZIF-8 is a stable, inexpensive material that is transparent in the visible (vis) and near-infrared (NIR) window. This is crucial for NLO applications. The second-order NLO activity is due to the noncentrosymmetric octupolar symmetry of the material. We found that fast syntheses lead to a lower second-order NLO response. Consistent with polarized second-harmonic generation (SHG) microscopy measurements, we ascribe this to defects that create local centers of centrosymmetry but do not affect the orientation of the crystal lattice. Syntheses with slow nucleation lead to quasi-perfect crystals with a large average second-order NLO coefficient ⟨deff⟩ of 0.25 pm/V, which is explained and supported by ab initio theoretical calculations.