George King-Thompson, 20, from Oxford, climbed the 310m building - one of the tallest in Europe - from the ground floor to near the very top in just 45 minutes in July this year.
London Bridge Station was briefly closed and King-Thompson later received a police caution after he was spotted on the side of the skyscraper at around 5am on 8 July.
Contempt of court admission
King-Thompson appeared at a hearing in London today to admit being in contempt of court.
Imposing an immediate custodial sentence, Mr Justice Murray said King-Thompson's breach of the order was "deliberate and knowing" and that "he would have walked past at least ten copies" of the order during his climb.
The judge said "iconic buildings are sometimes the targets of terrorists" and that "information regarding ways into and around the building" could increase the risk to people living and working inside.
Sentencing King-Thompson to six months in a young offenders' institution, he said "despite his young age and previous good character, it is not a sentence I am able to suspend".
David Forsdick QC, representing Teighmore, earlier told the court King-Thompson had spent around eight months planning his climb, had moved to east London "specifically to prepare" and visited The Shard up to 200 times, sometimes wearing disguises.
Mr Forsdick submitted that King-Thompson "knew of The Shard injunction" and "consciously and deliberately did what he knew was a breach of it, knowing that that could result in imprisonment".
In his written case, Mr Forsdick said that King-Thompson "recognised that the climb was illegal" by using the hashtag "rooftopillegal" when posting a video of the climb on Instagram.
He said the climb was a "highly dangerous trespass, both to him and potentially to members of the emergency services and the public if he had fallen".
An unreserved apology
Philip McGhee, for King-Thompson, told the court: "He wishes to make an unreserved apology for his actions, and that is an apology to the court first and foremost."
He said King-Thompson also wished to repeat his earlier apology to any commuters who might have been "inconvenienced" by London Bridge Station being closed, and to the police and ambulance services which attended The Shard.
He explained King-Thompson had attention deficit hyperactivity disorder (ADHD) and that, when he was "meticulously preparing and planning" the climb, he developed "almost an obsessive focus on the detail".
'Not in it for the fame'
He said his client was "not in this for fame or notoriety, whatever might be thought by some", and that he had "laudable aims" to "inspire others".
Mr McGhee concluded: "Mr King-Thompson will not climb another building in the UK. He very much regrets and is very sorry for doing what he did in July."
The Shard owners state their case
In a statement, a spokesman from Real Estate Management (UK) Limited, which manages The Shard, said: "Mr George King-Thompson has today been found to be in contempt of court for breaching the terms of an injunction set by the High Court in 2018 when he climbed The Shard earlier this year.
"We felt we had no option than to secure the injunction and ask the court to uphold it.
"We hope that today's outcome will deter other prospective climbers, and help them recognise the great dangers that these actions pose to the public, emergency services and themselves."