To solve the radio frequency identification problem, an anti-collision algorithm based on the Gray code (BSGC) was developed. The proposed algorithm reduces the effort required to search for tag prefixes in accordance with Gray code regulations and enhances the identification speed through efficient division and branching of the collision tags. The results of simulation and subsequent analysis of the proposed algorithm confirm that it effectively reduces the number of collisions and transmission delays, enhances the throughput rate, and increases the tag identification efficiency.