We give a dimension independent formulation of the quantum search algorithm introduced in [L. K. Grover, Phys. Rev. Lett. {bf 79}, 325 (1997)]. This algorithm provides a quadratic gain when compared to its classical counterpart by manipulating quantum two--level systems, qubits. We show that this gain, already known to be optimal, is preserved, irrespectively of the dimension of the system used to encode quantum information. This is shown by adapting the protocol to Hilbert spaces of any dimension using the same sequence of operations/logical gates as its original qubit formulation. Our results are detailed and illustrated for a system described by continuous variables, where qubits can be encoded in infinitely many distinct states using the modular variable formalism.