The John & Marcia Goldman Foundation donated the money in a grant given to the city in late 2013, said Maria Kong, director of grants and operations for the Goldman Foundation.
The Make-A-Wish Foundation held a series of events on Nov. 15 for Miles Scott, a 5-year-old recovering from leukemia who fulfilled his wish to be Batman for a day.
Miles fought villains in staged events that brought out thousands of onlookers and many more following on social media. The costs to the city came primarily from the final event, a large celebration in Civic Center Plaza with Mayor Ed Lee and police Chief Greg Suhr.
Make-A-Wish officials had offered to raise money to offset the city's costs, but that proved unnecessary following the donation by the Goldmans.
"John and Marcia Goldman are the epitome of philanthropy and are a big reason why San Francisco is a great city," said Patricia Wilson, executive director of the Make-A-Wish Greater Bay Area chapter.
"We are honored and humbled to have their support -- not just as donors, but opening doors as volunteers to make so many wishes possible over the years," Wilson said. "Their selfless and most generous gift is moving beyond words."
She said, "Obviously, the Batkid phenomenon touched many hearts and inspired so much goodness in San Francisco -- and this phenomenon continues thanks to the Goldmans."
A San Francisco native, John Goldman is active in various philanthropic efforts, worked in the insurance industry and is a past president of the San Francisco Symphony.
He and Marcia Goldman live on the Peninsula, according to the symphony's website.