A major project to rehab the Williamsburg Bridge will cause headaches for straphangers over the next two years.

The city Department of Transportation last month inked a $167 million contract to replace aging infrastructure on the 118-year-old crossing. Preliminary schedules published in contract documents show the work will force J and M train service to close during 25 weekends in 2023 and 2024.

MTA spokesperson Aaron Donovan said there is not yet a set schedule for the closures — but a “suggested schedule” issued by the DOT to contractors point to two weekend-long closures of the J and M trains each month from May through October 2023, and from April through September 2024.

Corroded floorbeams are among the components in need of repair on the Williamsburg Bridge.

The proposed schedule also includes a pair of weekend J and M train closures next month to allow construction crews to survey tracks.

The work will require partial closures of the bridge’s bike and walking paths — which are split on the central part of the bridge — on nights and weekends throughout 2023 and 2024.

DOT spokesperson Tomas Garita said “impacts on the bike and pedestrian paths are not anticipated, but if needed will be coordinated well in advance of any closures.”

The project to restore the bridge is necessary to replace corroded steel and ensure its towers do not fall into disrepair, the contract shows. Images shared by the DOT in contract documents show heavily corroded structures supporting the J train tracks. Drainage pipes, valves and joints that hold the bridge together must also be replaced and crumbling concrete must be patched.

The entire project is scheduled to wrap in mid-2025, according to contract documents.

This story has been updated to note that service on the M train will also be affected.