The NYPD is planning to surround the Times Square New Year’s celebration with more than 150 trucks to protect an expected 2 million revelers from a Nice- or Berlin-style attack.

Assigned to the revelry are 65 sand-filled trucks and 100 other so-called blocker vehicles — in addition to nearly 7,000 NYPD officers — positioned to stop an attacker from driving into the crowd, officials said Thursday.

Similar precautions are being taken at other New Year’s events across the city, including at Coney Island and Central Park, said NYPD Chief of Department Carlos Gomez, who outlined the city’s steps at a news conference.

“As we formulated this year’s plan, we paid close attention to world events and we learned from those events,” Gomez said. “And this year, due to the terrorist attacks in Nice, France, and in Berlin, Germany, we’ve enhanced our security measures.”

The city also used sand-filled trucks at the Thanksgiving Day Parade.

In July, 86 people were killed and more than 400 injured in a terror attack at a Bastille Day event in Nice when a cargo truck plowed through the crowd. Earlier this month, 12 people were killed and dozens wounded in a truck attack at a crowded Christmas market in Berlin.

advertisement | advertise on newsday

NYPD officials said there is no specific threat directed at the New Year’s event in Times Square, where the annual midnight ball drop heralding the new year is televised worldwide.

“New Year’s Eve, we expect as per usual, over a million people,” Mayor Bill de Blasio said. “I’m not quite sure why a million people want to stand in the freezing cold for a long, long period of time, but they do, and we’ll be ready for them.”

Plainclothes cops trained to detect suspicious behavior and other officers armed with heavy weaponry will mix in with the crowd.

Crowds are expected to begin filling the 65 pens stretching to 59th Street — each holding about 3,000 people — as early as 8 a.m. Saturday, Gomez said.

Police officers are planning to require everyone entering Times Square to go through a metal detector and be screened for radiation. Umbrellas, alcohol and big bags are banned.

Cops are also planning to sweep nearby hotels, theaters and parking garages.

In a break with past years, when crosstown streets like 57th and 59th were periodically open to traffic, the city is planning to ban all vehicles from those thoroughfares.

The estimated cost of securing New Year’s Eve is $5.2 million, according to the NYPD.