A scheme for implementing a conditional z gate in the decoherence-free subspace of superconducting quantum-interference devices (SQUIDs) is presented based on the dispersive interaction. Each logic qubit is encoded in the ground states of two rf SQUIDs, which own lower energy and can be relatively stable in operation. By switching on/off the classical pulses and selecting the gating time appropriately, a high fidelity is obtained. Moreover, this scheme can be generalized to the multi-qubit case without changing the gating time.Keywords Conditional z gate · Decoherence-free subspaces · SQUID Quantum computer is a kind of information processor which uses the principles of superposition and entanglement of quantum mechanics to solve certain mathematical problems faster than classical computer, such as factorizing a number and searching for data in an array [1,2]. So far, a lot of substantial efforts have been dedicated to the field of quantum computation and a number of significant progresses have been made, for instance, iontrap system [3], cavity quantum electrodynamics (QED) [4,5], nuclear magnetic resonance (NMR) system [6] and linear optics [7].While the quantum computer is more powerful than the classical counterpart, the coherence between qubits would be destroyed since the system cannot be placed in a totally closed condition in practice. To avoid the decoherence effect, different methods are applied to implement quantum computation. A straight way is to find an effective path to suppress