A safety device is adapted to be sleeved on a needle unit of a syringe. The safety device includes a barrel unit movable with respect to a base seat of the needle unit and having a connecting end portion and a flexible end portion that has a pair of coupling sections provided respectively with first and second engaging members. The flexible end portion is operable between an opened state, where the coupling sections define an opening that permits extension of a cannula of the needle unit when the barrel unit is in a retracted state, and a closed state, where the flexible end portion deforms to result in engagement between the first and second engaging members to thereby close the opening when the barrel unit is moved to an extended state.