Trump, speaking to reporters after landing in the Washington area following a brief trip to New York, said he had been discussing the issue on the plane.
"We're working on a solution that may be very good," he said. He declined to give further details. "You'll be hearing about it pretty soon. We're trying to get it ended, get the hostages back."
Earlier, he warned Hamas to accept his terms of an agreement, without giving any specifics.
"The Israelis have accepted my Terms. It is time for Hamas to accept as well," Trump wrote on his Truth Social platform.
"I have warned Hamas about the consequences of not accepting. This is my last warning, there will not be another one!"
Hamas later said it received some ideas from the United States' side through mediators to reach a ceasefire deal in Gaza and was discussing ways to develop those ideas. It also gave no details of the possible agreement.
Hamas, in its statement, also reiterated its readiness for negotiations to release all hostages in exchange for a "clear announcement of an end to the war" and the complete withdrawal of Israeli forces from the enclave.
Trump told reporters he thought all the hostages would be returned: "I think we're going to get them all."
He noted some may already have died but the aim would be to have their bodies returned.
On Saturday, Israel's N12 News reported Trump had put forth a new ceasefire proposal to Hamas.
Under the deal, Hamas would free all the remaining 48 hostages on the first day of the truce in exchange for thousands of Palestinian prisoners jailed in Israel and negotiate an end to the war during a ceasefire in the enclave, according to N12.
An Israeli official said Israel was "seriously considering" Trump's proposal but did not elaborate.
Meanwhile, a top UN official said on Sunday there was a "narrow window" to prevent famine from spreading further in Gaza, calling on Israel to allow unimpeded aid delivery in the territory.
"There is a narrow window - until the end of September - to prevent famine from spreading to Deir al Balah (in central Gaza) and Khan Younis (southern Gaza). That window is now closing fast," said United Nations aid chief Tom Fletcher.
COGAT, the Israeli defence agency that deals with humanitarian issues, said on Sunday that over the past week aid from more than 1900 trucks, most supplying food, was distributed in Gaza.
"We will continue facilitating humanitarian aid into Gaza for the civilian population - not Hamas," COGAT said in a statement.
Israel in August launched an assault on the outskirts of Gaza City and its forces are now just a few kilometres from the city centre, where it issued warnings over the weekend to civilians to evacuate high rise buildings it says are being used by Hamas, before bombing them.
Israel did not provide evidence to show Hamas was using the buildings, an accusation the militant group denied.
Overnight, strikes killed 14 people across the city, local health officials said, including a strike on a school in southern Gaza City sheltering displaced Palestinians.
The Israeli military said it had struck a Hamas militant and civilians had been warned before the strike was carried out.
The military on Saturday also warned Gaza City's civilians to leave for the south, including Khan Younis, where hundreds of thousands of Palestinians are already sheltering in cramped tent encampments along the coast.