Hadamard gate

Turns a definite 0 or 1 into an equal superposition, and back again.

Superposition · 1 qubit · reviewed November 2026

Matrix

1/√2 · [ 1   1 ]
       [ 1  −1 ]

What it does

|0⟩→(|0⟩ + |1⟩)/√2
|1⟩→(|0⟩ − |1⟩)/√2

In plain words

The Hadamard gate is the standard way to start a quantum computation. Applied to |0⟩ it gives equal amplitude to 0 and 1. Applied to |1⟩ it gives the same probabilities but with a minus sign on the |1⟩ part, which is a different state.

It swaps the Z basis (0 and 1) with the X basis (plus and minus). That is why H sandwiches appear so often: H, then a Z, then H acts like an X.

Identities

  • H·H = I (it undoes itself)
  • H·Z·H = X and H·X·H = Z
  • H·S·H = a rotation by 90° about the X axis, up to a global phase

Where it is used

  • Creating superposition at the start of nearly every algorithm
  • Interference steps in Grover, Deutsch–Jozsa and Bernstein–Vazirani
  • Basis changes before measuring in the X basis

Code

# Qiskit
qc.h(0)

// OpenQASM 2.0
h q[0];

Qiskit prints qubit 0 on the right of a bitstring. The builder prints it on the left.

See it in an example

Related gates

Questions

Is the Hadamard gate its own inverse?

Yes. Applying it twice returns the original state exactly.

Try the H gate in the Circuit Builder →