It is not known when Li Rangyi was born, and his family background was not clearly stated in traditional historical accounts other than that, according to his biographies in the Old Book of Tang and the New Book of Tang, his family was from the Li clan of Longxi — although the New Book of Tang did not list him among the chancellors from the Longxi Li clan. His grandfather was named Li Yue and his father was named Li Yinggui, although, if they carried any official titles, those titles were lost to history. According to the tombstone of the Buddhist nun Li Shencai , which indicated that Li Rangyi was her older brother, the family was from another prominent Li clan, of Zhao Commandery, but further based on that assertion and other parts of the epitaph, the researchers Cheng Yi, Xiao Jianyi, and Wang Weikun concluded that Li Rangyi's family was not prominent and was not from either the Longxi or the Zhao Li clan. Li Rangyi passed the imperial examinations in the Jinshi class in 819, during the reign of Emperor Xianzong. He thereafter served on staffs of regional governors.
During Emperor Wenzong's reign
Early in the Taihe era of Emperor Xianzong's grandson Emperor Wenzong, Li Rangyi was recalled to the Tang capital Chang'an to serve as You Shiyi, a low-level advisory official at the legislative bureau of government. Thereafter, he was promoted to be Zuo Bujue, a slightly-higher-ranked advisory official at the examination bureau and made an imperial scholar. In 829, he was made Zhifang Yuanwailang, a low-level official at the ministry of defense, and then Zuosi Langzhong, a supervisory official under one of the secretaries general of the executive bureau, while continuing to serve as imperial scholar. In 835, he was made Jianyi Daifu, a high-level advisory official. In 836, Li Rangyi, in addition to his other posts, was also made a supervisory imperial chronicler — but his commission came after a dispute between the chancellors. His predecessor as Qiju Sheren, Li Bao, had suffered from chronic illness and requested to resign. When the chancellor Li Shi reported this to Emperor Wenzong, Emperor Wenzong pointed out that the early Tang chancellor Chu Suiliang had served as both Jianyi Daifu and Qiju Sheren at one point, and that he believed that one of the Jianyi Daifu could do so. He requested that Li Shi submit the list of the current Jianyi Daifu; Li Shi submitted the names of Li Rangyi, Feng Ding, Sun Jian, and Xiao Chu. Emperor Wenzong indicated that Li Rangyi was acceptable to him, but another chancellor, Li Guyan, recommended Cui Qiu and Zhang Cizong. Yet another chancellor, Zheng Tan, then spoke against Cui, arguing that Cui had improperly associated with the former chancellor Li Zongmin, and further stated that he would have no objections whatsoever if Emperor Wenzong selected Li Rangyi or Pei Zhongru. In 837, Li Rangyi was made Zhongshu Sheren, a mid-level official of the legislative bureau. However, because of the 836 controversy, subsequently, after Li Zongmin's alliesYang Sifu and Li Jue became chancellors, Li Rangyi would not again be promoted for the rest of Emperor Wenzong's reign.
During Emperor Wuzong's reign
After Emperor Wenzong died in 841 and was succeeded by his brother Emperor Wuzong, Li Deyu became the leading chancellor, and Li Deyu had Li Rangyi promoted repeatedly — as deputy minister of public works, deputy minister of census, and then one of the secretaries general of the executive bureau of government. In 842, he was made Zhongshu Shilang, the deputy head of the legislative bureau and chancellor de facto with the designationTong Zhongshu Menxia Pingzhangshi.
During Emperor Xuānzong's reign
After Emperor Wuzong died in 846 and was succeeded by his uncle Emperor Xuānzong, Li Rangyi was given the title of Sikong and put in charge of overseeing construction of Emperor Wuzong's tomb. Soon thereafter, Li Deyu lost power, and both he and Li Rangyi were removed from their chancellor posts. Li Rangyi, even before the tomb was complete, was made the military governor of Huainan Circuit. He soon grew ill and requested a return to Chang'an, and he died on the way back to Chang'an. He was given posthumous honors. It was said that Li Rangyi was frugal and did not make improper associations, and was praised for it.