Air quality worsened in New York City over the day Wednesday, as wildfire smoke continued to roll in from Canada. Libraries and city train stations were giving out free KN95 masks for anyone struggling to breathe.

The masks are available at all Brooklyn and Queens public library locations, along with the St. George Library Center on Staten Island, the Bronx Library Center, and the Stavros Niarchos Foundation Library in Manhattan, the city’s Office of Emergency Management said late Tuesday. The MTA said masks would also be available at subway, LIRR, and Metro-North stations.

The Air Quality Index was showing "unhealthy for sensitive groups" or "unhealthy" levels across the five boroughs mid-Wednesday, after having been listed as "moderate" earlier in the day. Meteorologists from the National Weather Service said the air could potentially worsen further if the smoke mixes closer to the surface. Air quality was listed as unhealthy in central New York and parts of the state further northwest.

Sensitive groups can include children and teens, the elderly, pregnant people, people with asthma, people with lung and heart conditions, people who exercise and work outdoors, and people in disadvantaged communities. Officials advised people in those groups to stay inside, near air conditioning if possible.

The smoky conditions on Wednesday are set to coincide with extreme heat and humidity across the five boroughs, with temperatures expected to reach close to 100 degrees. A heat advisory will be in effect until 9 p.m.

Amanda Lefton, commissioner for of the state Department of Environmental Conservation, said Wednesday that says visible smoke doesn't necessarily mean poor air quality.

"The most important thing New Yorkers can do is, again, stay air quality aware so that they can take the right precautions, leverage those resources as well as do what they can to avoid strenuous activity outside."

A gray haze from the Ontario fires drifted across the New York City region on Tuesday, prompting officials from the state health department to issue an air quality health advisory that included Rockland and Westchester counties and Long Island. The advisory was in effect until 11 p.m., and it was not immediately clear whether they would be issuing another one for Wednesday.

The city’s Office of Emergency Management said it would be monitoring conditions alongside the state’s Department of Environmental Conservation and the National Weather Service.

“Any temporary spikes in fine particulate matter (PM2.5) are currently expected to stay below air quality health advisory triggers, but conditions can change,” the agency wrote in a post on X. “Know your risk. If you're sensitive to air quality, including older adults, children, pregnant individuals, and people with heart or lung conditions, plan to be in a cool indoor space with air conditioning or filtration.”

New Yorkers looking to beat the heat and stay safe can find their nearest cooling centers here.

This story has been updated with more information.