An optical image stabilization mechanism is provided, including a holder for holding a lens, a frame, a base, a first coil, a second coil, a displacement sensor, a first magnetic element, a second magnetic element, and a third magnetic element. The frame is movably connected to the holder and the base. The first coil is disposed on a side of the holder. The second coil is disposed on the base. The first and second magnetic elements are disposed on the frame and correspond to the first coil. The magnetic pole direction of the first magnetic element is opposite to that of the second magnetic element. The third magnetic element is disposed on the frame and corresponds to the second coil. The displacement sensor is disposed on the base to detect relative displacement between the lens and the base.