A nondeterministic quantum CNOT gate (10) for photon qubits, with success probability 1/9, uses beamsplitters (B1–B5) with selected reflectivities to mix control and target input modes. It may be combined with an atomic quantum memory to construct a deterministic CNOT gate, with applications in quantum computing and as a Bell-state analyser.