A safety needle has a needle base, a puncture needle, and a safety cap. The puncture needle is inserted into a front end of a needle connection segment of the needle base. The safety cap is combined with a front end of the needle base. The safety cap has a needle cap and a resilient member mounted in the needle base. The needle cap is mounted around the puncture needle. Guiding blocks formed on the rear end of the needle cap are mounted respectively in positioning recesses in a housing of the needle base. The needle cap and an outer cap are mounted around the puncture needle, and the puncture needle can be kept from exposure. The needle cap can be locked with the positioning recesses, and the safety needle cannot be reused and can be distinguished as a used needle.