The modern border dates from the period of the British Raj when Britain controlled India, which then included what is now Pakistan.
In 1899, the British, via its envoy to China Sir Claude MacDonald, proposed what became known as the MacDonald Line to the Chinese government, however the Chinese never responded to the proposal and thus this border was never formalised.

Over the following decades a variety of maps were issues by all sides in the dispute, showing wildly varying boundaries.
India and Pakistan inherited the dispute upon independence in 1947, further complicated by their dispute over ownership of Jammu and Kashmir.
The issue came to the fore in the early 1960s, at a time of intense tension in the region due to ongoing failure to solve the Indo-Pakistani dispute over Kashmir, a much larger Chinese presence in Tibet, and the Sino-Indian War of 1962 in which China had seized control of the Indian-claimed Aksai Chin region.
In 1961 China and Pakistan agreed in principle to demarcate their common border; negotiations commenced the following year, with the final Sino-Pakistan Agreement being signed in 1963.
Both sides made concessions in the treaty, with Pakistan giving China the area around the Shaksgam Valley known as the Trans-Karakoram Tract.
Following the treaty a series of maps and aerial surveys of the border area were made and boundary pillars were installed.
The modern border dates from the period of the British Raj when Britain controlled India, which then included what is now Pakistan. In 1899, the British, via its envoy to China Sir Claude MacDonald, proposed what became known as the MacDonald Line to the Chinese government, however the Chinese never responded to the proposal and thus this border was never formalised.
Over the following decades a variety of maps were issues by all sides in the dispute, showing wildly varying boundaries. India and Pakistan inherited the dispute upon independence in 1947, further complicated by their dispute over ownership of Jammu and Kashmir. The issue came to the fore in the early 1960s, at a time of intense tension in the region due to ongoing failure to solve the Indo-Pakistani dispute over Kashmir, a much larger Chinese presence in Tibet, and the Sino-Indian War of 1962 in which China had seized control of the Indian-claimed Aksai Chin region. In 1961 China and Pakistan agreed in principle to demarcate their common border; negotiations commenced the following year, with the final Sino-Pakistan Agreement being signed in 1963. Both sides made concessions in the treaty, with Pakistan giving China the area around the Shaksgam Valley known as the Trans-Karakoram Tract. Following the treaty a series of maps and aerial surveys of the border area were made and boundary pillars were installed.
China–Pakistan border