Passive UHF RFID systems using Dynamic Frame-Slotted ALOHA (DFSA) adjust the frame size according to the number of tags, but frame size N is equals to 2Q and cannot be adjusted exactly to the number of tags to be identified. In this paper, we propose an optimal Aloha algorithm (ODFSA), which uses probabilistic approach for tags to access the frame. The Query or Query Adjust packet contains both the parameter Q and P called frame access probability, which represents the ratio of number of active tags in the current frame to the estimated total number of tags which remain to be identified in the system. Estimation of number of unread tags is updated after end of each frame; parameters Q and P are calculated and informed at the beginning of each frame. Mathematical analysis and computer simulations show that the proposed Aloha achieves maximum system efficiency, utilizes less number of slots compared with other algorithms and also takes less identification time.