President Barack Obama has commuted Chelsea Manning's sentence for leaking documents to Wikileaks in 2010.
The 29-year-old transgender US Army private, born Bradley Manning, will be freed on 17 May instead of her scheduled 2045 release.
She was sentenced to 35 years in 2013 for her role in leaking diplomatic cables to the anti-secrecy group.
The leak was one of the largest breaches of classified material in US history.
The White House had suggested in recent days it was open to commuting Manning's sentence.
She twice attempted suicide last year at the male military prison where she is being held at Fort Leavenworth, Kansas.
Manning also went on a hunger strike last year, which ended after the military agreed to provide her with gender dysphoria treatment.
In one of his final acts as president, Mr Obama granted commutation of sentences to 209 individuals and pardons to 64 others.
Among those pardoned on Tuesday were retired General James Cartwright, who was convicted of making false statements during an investigation into disclosure of classified information.
Cartwright was questioned by the FBI in 2012 over a New York Times reporter's expose on a malicious computer program known as Stuxnet that was designed to disrupt Iran's nuclear programme.
The US Army charged Manning with 22 counts relating to the unauthorised possession and distribution of more than 700,000 secret diplomatic and military documents and video.
Included in those files was video footage of an Apache helicopter killing 12 civilians in Baghdad in 2007.
Manning also passed on sensitive messages between US diplomats, intelligence assessments of Guantanamo detainees being held without trial and military records from the wars in Iraq and Afghanistan.
The disclosures were considered an embarrassment to the US, prompting the Obama administration to crack down on government leaks.
At a sentencing hearing, Manning apologised for "hurting the US" and said she had mistakenly thought she could "change the world for the better".
Obama commutes Chelsea Manning sentence - BBC News