To decipher the mechanism of high-temperature superconductivity, it is important to know how the superconducting pairing emerges from the unusual normal states of cuprate superconductors, including the pseudogap, strange metal and anomalous Fermi liquid phases. A long-standing issue is how the superconducting pairing is formed and condensed in the strange metal phase, because this is where the superconducting transition temperature is highest. Here, we use state-of-the-art high-pressure measurements to report the experimental observation of a pressure-induced crossover from two- to three-dimensional (2D to 3D) superconducting states in optimally doped Bi2Sr2CaCu2O8 + δ bulk superconductor. By analysing the temperature dependence of the resistance, we find that the 2D superconducting transition exhibits a Berezinskii–Kosterlitz–Thouless-like behaviour. The emergence of this 2D superconducting transition provides direct evidence that the strange metal state is predominantly 2D-like. This is important for a thorough understanding of the phase diagram of cuprate superconductors.