An important approach to curtail building energy consumption is to optimize building control based on occupancy information. Various studies proposed to estimate occupant counts through different approaches and sensors. However, high cost and privacy concerns remain as major barriers, restricting the practice of occupant count detection. In this study, we propose a novel method utilizing data from widely deployed Wi-Fi infrastructure to infer occupant counts through machine learning. Compared with the current indirect measurement methods, our method improves the performance of estimating people count: (1) we avoid privacy concerns by anonymizing and reshuffling the MAC addresses on a daily basis; (2) we adopted a heuristic feature engineer approach to cluster connected devices into different types based on their daily connection duration. We tested the method in an office building located in California. In an area with an average occupancy of 22–27 people and a peak occupancy of 48–74 people, the root square mean error on the test set is less than four people. The error is within two people counts for more than 70% of estimations, and less than six counts for more than 90% of estimations, indicating a relatively high accuracy. The major contribution of this study is proposing a novel and accurate approach to detect occupant counts in a non-intrusive way, i.e., utilizing existing Wi-Fi infrastructure in buildings without requiring the installation of extra hardware or sensors. The method we proposed is generic and could be applied to other commercial buildings to infer occupant counts for energy efficient building control.