Liu was born in Tongji Hospital in Wuhan, Hubei and her birth name was "An Feng". She is an only child. Her father is An Shaokang (安少康), a 1st Secretary in the Chinese Embassy in France and a French language university professor, while her mother is Liu Xiaoli (刘晓莉), a dancer and a stage performer. Her parents divorced when she was 10 years old and she was raised solely by her mother. That same year, she adopted her mother's family name and changed her legal name to "Liu Ximeizi" and began modelling, along with training in singing, dancing and playing the piano. Her godfather is Chen Jinfei (陈金飞), the Chairman of Beijing Tongchan Investment Group (北京通产投资集团).
When she was 11 years old, Liu and her mother moved to New York City, where she attended Louis Pasteur Middle School 67. She returned to China in 2002 to pursue an acting career and adopted the stage name "Liu Yifei" (刘亦菲). Several weeks later, Liu was accepted into the Performance Institute of Beijing Film Academy at the age of 15, and graduated in 2006.
Immediately after her admittance into the Beijing Film Academy, Liu Yifei received offers to star in various television series. Her first television appearance was in The Story of a Noble Family (2003), based on Zhang Henshui's novel of the same name. The series achieved the highest ratings on CCTV, and positive reviews from audience. The same year, she was chosen by Zhang Jizhong to play Wang Yuyan in Demi-Gods and Semi-Devils, an adaptation of Louis Cha's novel of the same title. The series was broadcast in Taiwan and achieved a rating of 5.69, becoming the highest-rated mainland drama in Taiwan. Liu's role as the beautiful Wang Yuyan earned her the nickname of "Fairy Sister" by the media and fans.
Liu then starred in Chinese Paladin (2005), adapted from the action RPG The Legend of Sword and Fairy. The drama achieved extremely high ratings of 2.7, and solidified her popularity in China.
Liu was cast as the female protagonist Xiaolongnü in The Return of the Condor Heroes, based on Louis Cha's novel of the same title. Liu's casting was backed by Cha himself, who felt that she had all the necessary qualities to portray the young and innocent female protagonist. After the drama aired, Liu gained acclaim for performance. The same year, she was chosen as the "Golden Eagle Goddess" at the 6th China Golden Eagle TV Art Festival.
After achieving success in television, Liu then ventured onto the big screen. In 2008, she starred in her first Hollywood production The Forbidden Kingdom. She played Golden Sparrow, an orphan seeking revenge against her parents' killer. Thereafter, she starred in romantic-comedy Love in Disguise (2010) opposite Taiwanese singer-actor Wang Leehom and Wilson Yip's A Chinese Ghost Story (2011) with Louis Koo.
She then starred in White Vengeance (2011), a historical epic based on the well-known legend of Liu Bang and Xiang Yu of the Qin Dynasty. The same year, she was cast as Wu Qing (Emotionless) in Gordon Chan's wuxia film The Four, adapted from Woon Swee Oan's novel series The Four Great Constables.
Liu won her first major acting award in her 11-year career, the Best Actress award at the 5th Macau International Movie Festival, for her role as Lingju in The Assassins (2012).
Liu collaborated with Korean actor-singer Rain for the 2014 film For Love or Money, based on Hong Kong novelist Amy Cheung's 2006 novel of the same name. Though it did reasonably well at the box office, the film was criticized for its storyline and production. She then starred in the American-Chinese action film Outcast (2014) directed by Nick Powell, alongside Nicolas Cage and Hayden Christensen.
Liu starred in another Chinese-South Korean co-production, The Third Way of Love (2015), a romance melodrama co-starring Song Seung-heon. Her performance in the film led to her win for the Most Anticipated Actress award at the 16th Chinese Film Media Awards. The same year, she was named the first Chinese ambassador of Dior Prestige and became the global ambassador of Tissot.
Liu then starred in Night Peacock (2016), a Chinese-France co-production directed by Dai Sijie. The film was awarded first prize under the Special Chinese Film category at the 40th Montreal World Film Festival, and Liu was nominated as Best Actress. She then starred alongside Kris Wu in romance film Never Gone.
In 2017, Liu starred alongside Yang Yang in romantic fantasy film Once Upon a Time by award-winning director Anthony LaMolinara and Zhao Xiaoding. She also starred in the historical film The Chinese Widow directed by Bille August. The film premiered at the Shanghai International Film Festival as the opening film, and Liu was nominated as Best Actress.
Liu has been cast alongside Samuel L. Jackson in the American-Chinese science fiction film Inversion, directed by Peter Segal.
Liu Yifei signed with Sony Music Entertainment Japan in 2005. She released her first Japanese single "Mayonaka no Door" with Sony Music on July 19, 2006. Her debut album Liu Yifei was released the next month in various parts of Asia such as mainland China, Taiwan, Hong Kong and throughout Southeast Asia, featuring a diverse music repertoire including rap and soft rock. In the same year, Liu also released her Japanese album in which the single, "Mayonaka no Doa" was chosen to be the theme for an animation series Demashita! Powerpuff Girls Z by Tokyo TV.