A bar feeder includes a feeder tube mounted on a machine base, a transmission mechanism, a driving mechanism having a rotary shaft, a projecting rod connected to the driving mechanism and rotatable with the rotary shaft to engage or disengage from the transmission mechanism, a pushing rod, and a driven mechanism rotatable with the rotary shaft to move the pushing rod into engagement or away from the transmission mechanism. When the pushing rod and the transmission mechanism are coupled together, the pushing rod is movable along the feeder tube, and the projecting rod is disengaged from the transmission mechanism and moved away from the feeder tube. When the pushing rod and the transmission mechanism are disconnected, the pushing rod is not movable along the feeder tube, and the projecting rod is coupled to the transmission mechanism and movable along the feeder tube.