A government spokesman described the outbreak as "ferocious".
All residents living in the area where the bar is located will be tested over the next three days.
The number of infections in the city is low by international standards but high for China, which is the world's only major economy still maintaining a "zero Covid" policy.
The outbreak was traced to a venue called the Heaven Supermarket Bar, in the well-known entertainment area of Sanlitun in Chaoyang district.
Two buildings housing hundreds of people in Chaoyang were put under strict lockdown on Sunday after a positive case was reported, a residential committee worker told Reuters news agency.
Some people in Beijing said they were sent texts telling them to report to authorities if they had recently visited Sanlitun's bars.
Chinese officials have reversed the relaxation of some Covid rules in Beijing because of the outbreak.
Most children in the capital will not return to school next week as originally planned, officials said.
The capital has reported 1,997 local Covid cases since 22 April.
China's overall policy of "zero Covid" remains in place and people catching Covid face quarantine or hospital.
Their close contacts also face the prospect of removal to quarantine and the area immediately around where they live being locked down again.
The city of Shanghai, the country's economic centre and a global trade hub, recently eased Covid curbs after a two-month lockdown.