We find that a porous piezoelectric medium stabilizes electrodeposition and suppresses dendrite. The effect is 6 orders of magnitude larger than mechanical blocking. We develop a theory integrating electrochemistry, piezoelectricity, and mechanics. A piezoelectric overpotential is derived, which reveals a fundamental relation to surface charge density, dielectric property of the medium, electrolyte concentration and diffusivity, and the reaction coefficient. The simulations show that piezoelectric medium suppresses electrodeposition on any protrusion, leading to a flat, dendrite-free surface.