"Chief Prosecutor Marianne Ny has today decided to discontinue the preliminary investigation regarding suspected rape concerning Julian Assange," the prosecutors office said in a statement.
Assange, 45, took refuge in Ecuador's embassy in London in 2012 to escape extradition to Sweden to answer questions about sex-crime allegations from two women, which he denies. He has been there ever since, fearing that if he is arrested he might ultimately be extradited to the United States.
Friday's announcement means Assange is no longer under any investigation in Sweden.
British police said Assange would still be arrested if he leaves the embassy.
"Westminster Magistrates' Court issued a warrant for the arrest of Julian Assange following him failing to surrender to the court on the 29 June 2012," London police said in a statement. "The Metropolitan Police Service is obliged to execute that warrant should he leave the Embassy."
Reuters contributed to this report.