People holding candles and torches observed a minute's silence at the start of the main event in Copenhagen.
Two people were killed and five police were injured in attacks on a free speech debate and a synagogue.
The gunman was later shot dead by police. He did not appear to be part of a wider terror cell, Denmark's PM said.
Earlier on Monday, two men were charged with providing and disposing of the weapon used in the attacks and helping the gunman to hide.
The gunman was named by local media as Omar El-Hussein.
The national flag flew at half-mast on official buildings across the capital on Monday.
Floral tributes have been placed by mourners at the site of the two attacks.
Some also put flowers at the place where police shot the suspect dead. One told Danish TV2: "I did it because I am Muslim and because I knew him."
As dusk fell on Monday a vast crowd gathered for the Copenhagen event, held on a square near the cultural centre where one of the attacks took place.
A police spokesman said the crowds numbered about 30,000.
Prime Minister Helle Thorning-Schmidt told the audience that an attack on the Jews of Denmark "is an attack on Denmark, on all of us".
She also again vowed that Denmark was determined to safeguard its values.
The prime minister earlier told a news conference the attacker was a Danish-born man aged 22.
"He was known by the police for several criminal acts, including severe violence, and he was also known to be linked to a criminal gang in Copenhagen. "
"But I want to also make very clear that we have no indication at this stage that he was part of a cell."
Omar El-Hussein: homegrown radical
The two suspects being held by police appeared in a closed custody hearing on Monday.
Michael Juul Eriksen, a defence lawyer for one of them, said they denied the charges.
Omar El-Hussein was released from prison two weeks before the attacks after serving a sentence for grievous bodily harm.
Danish intelligence chief Jens Madsen acknowledged that El-Hussein had been "on the radar" of his services.
Mr Madsen said investigators were working on the theory that he could have been inspired by the shootings in Paris last month.
The attacks on the Charlie Hebdo magazine, a kosher supermarket and a policewoman claimed 17 lives.
In the first of the two shootings on Saturday, at a free-speech debate in the east of the city, film director Finn Norgaard, 55, was killed.
In an audio recording of the shooting, the gunman can be heard interrupting the debate and firing dozens of shots.
Hours later, Dan Uzan, a 37-year-old long-time member of the Copenhagen synagogue, was shot dead while on security duty outside the building. Eighty people were celebrating a girl's bat mitzvah, or coming of age, in a hall behind the synagogue at the time.
The gunman fled by car but was traced by police to the city's Norrebro district. He opened fire when confronted and was fatally shot by officers.
In another development, controversial cartoonist Lars Vilks - who believes he was probably a target of one of the attacks - says he has gone into hiding. He told Channel 4 News he was now in a "secret place".
Finn Noergaard, 55, was struck in the chest by a bullet at the free speech debate. The documentary film-maker had a keen interest in the problems faced by the offspring of migrant communities.
His friend Malene Trock told Berlinske daily he was "open-minded" and "cosmopolitan". Producer Torben Larsen is quoted by the AP news agency as saying Mr Noergaard was "a very generous and warm person".
Dan Uzan, 37, was shot dead while standing guard at a Copenhagen synagogue.
He had studied at the city's university and was a keen basketball player, active in a local team. Denmark's chief rabbi, Jair Melchior, said Mr Uzan was an "amazing guy - irreplaceable".
Why Denmark was steeled for attack
French PM urges Jews to stay after graves desecration
Tens of thousands of people have gathered in towns and cities across Denmark to commemorate the victims of weekend gun attacks in the capital.