In the Middle Ages, the site of the future palace formed part of the Manor of Ebury (also called Eia). The marshy ground was watered by the river Tyburn, which still flows below the courtyard and south wing of the palace. Where the river was fordable (at Cow Ford), the village of Eye Cross grew. Ownership of the site changed hands many times; owners included Edward the Confessor and his queen consort Edith of Wessex in late Saxon times, and, after the Norman Conquest, William the Conqueror. William gave the site to Geoffrey de Mandeville, who bequeathed it to the monks of Westminster Abbey.

In 1531, Henry VIII acquired the Hospital of St James, which became St James's Palace, from Eton College, and in 1536 he took the Manor of Ebury from Westminster Abbey.

Possibly the first house erected within the site was that of a Sir William Blake, around 1624. The next owner was Lord Goring, who from 1633 extended Blake's house and developed much of today's garden, then known as Goring Great Garden.

When the improvident Goring defaulted on his rents Henry Bennet, 1st Earl of Arlington was able to purchase the lease of Goring House and he was occupying it when it burned down in 1674, following which he constructed Arlington House on the site—the location of the southern wing of today's palace—the next year. In 1698, John Sheffield, later the first Duke of Buckingham and Normanby, acquired the lease.

The house which forms the architectural core of the palace was built for the first Duke of Buckingham and Normanby in 1703 to the design of William Winde. The style chosen was of a large, three-floored central block with two smaller flanking service wings.

Buckingham House was eventually sold by Buckingham's illegitimate son, Sir Charles Sheffield, in 1761 to George III for £21,000.

Under the new Crown ownership, the building was originally intended as a private retreat for King George III's wife, Queen Charlotte, and was accordingly known as The Queen's House. Re-modelling of the structure began in 1762.

While St James's Palace remained the official and ceremonial royal residence, the name "Buckingham-palace" was used from at least 1791.

State banquets also take place in the Ballroom; these formal dinners are held on the first evening of a state visit by a foreign head of state. On these occasions, for up to 170 guests in formal "white tie and decorations", including tiaras, the dining table is laid with the Grand Service, a collection of silver-gilt plate made in 1811 for the Prince of Wales, later George IV. The largest and most formal reception at Buckingham Palace takes place every November when the Queen entertains members of the diplomatic corps. On this grand occasion, all the state rooms are in use, as the royal family proceed through them, beginning at the great north doors of the Picture Gallery. As Nash had envisaged, all the large, double-mirrored doors stand open, reflecting the numerous crystal chandeliers and sconces, creating a deliberate optical illusion of space and light.

After his accession to the throne in 1820, King George IV continued the renovation with the idea in mind of a small, comfortable home.

However, in 1826, while the work was in progress, the King George IV decided to modify the house into a palace with the help of his architect John Nash.

On the death of George IV in 1830, his younger brother King William IV hired Edward Blore to finish the work.

After the destruction of the Palace of Westminster by fire in 1834, William considered converting the palace into the new Houses of Parliament.

Buckingham Palace finally became the principal royal residence in 1837, on the accession of Queen Victoria, who was the first monarch to reside there; her predecessor William IV had died before its completion.

The boy Jones was an intruder who gained entry to the palace on three occasions between 1838 and 1841.

Following the Queen's marriage in 1840, her husband, Prince Albert, concerned himself with a reorganization of the household offices and staff, and with addressing the design faults of the palace.

Smaller ceremonies such as the reception of new ambassadors take place in the "1844 Room". Here too, the Queen holds small lunch parties, and often meetings of the Privy Council. Larger lunch parties often take place in the curved and domed Music Room or the State Dining Room.

By 1847, Albert and Victoria had found the palace too small for court life and their growing family, and consequently the new wing, designed by Edward Blore, was built by Thomas Cubitt, enclosing the central quadrangle. The large East Front, facing The Mall, is today the "public face" of Buckingham Palace, and contains the balcony from which the royal family acknowledge the crowds on momentous occasions and after the annual Trooping the Colour. The ballroom wing and a further suite of state rooms were also built in this period, designed by Nash's student Sir James Pennethorne.

Investitures, which include the conferring of knighthoods by dubbing with a sword, and other awards take place in the palace's Ballroom, built in 1854. At 120 ft (36.6 m) long, 60 ft (18 m) wide and 45 ft (13.5 m) high, it is the largest room in the palace. It has replaced the throne room in importance and use. During investitures, the Queen stands on the throne dais beneath a giant, domed velvet canopy, known as a shamiana or a baldachin, that was used at the Delhi Durbar in 1911. A military band plays in the musicians' gallery as award recipients approach the Queen and receive their honours, watched by their families and friends.

Victoria widowed in 1861, the grief-stricken Queen withdrew from public life and left Buckingham Palace to live at Windsor Castle, Balmoral Castle and Osborne House. For many years the palace was seldom used, even neglected.

In 1864, a note was found pinned to the fence of Buckingham Palace, saying: "These commanding premises to be let or sold, in consequence of the late occupant's declining business".

In 1901, the accession of Edward VII saw new life breathed into the palace. The King and his wife, Queen Alexandra, had always been at the forefront of London high society, and their friends, known as "the Marlborough House Set", were considered to be the most eminent and fashionable of the age. Buckingham Palace—the Ballroom, Grand Entrance, Marble Hall, Grand Staircase, vestibules and galleries redecorated in the Belle Époque cream and gold color scheme they retain today—once again became a setting for entertaining on a majestic scale but leaving some to feel King Edward's heavy redecorations were at odds with Nash's original work.

The last major building work took place during the reign of King George V when, in 1913, Sir Aston Webb redesigned Blore's 1850 East Front to resemble in part Giacomo Leoni's Lyme Park in Cheshire. This new, refaced principal façade (of Portland stone) was designed to be the backdrop to the Victoria Memorial, a large memorial statue of Queen Victoria, placed outside the main gates.

During World War I, the palace, then the home of King George V and Queen Mary, escaped unscathed. Its more valuable contents were evacuated to Windsor, but the royal family remained in residence. The King imposed rationing at the palace, much to the dismay of his guests and household.

Formerly, men not wearing military uniform wore knee breeches of 18th-century design. Women's evening dress included trains and tiaras or feathers in their hair (often both). The dress code governing formal court uniform and dress has progressively relaxed. After the First World War, when Queen Mary wished to follow fashion by raising her skirts a few inches from the ground, she requested a lady-in-waiting to shorten her own skirt first to gauge the King's reaction. King George V disapproved, so the Queen kept her hemline unfashionably low. Following his accession in 1936, King George VI and Queen Elizabeth allowed the hemline of daytime skirts to rise. Today, there is no official dress code. Most men invited to Buckingham Palace in the daytime choose to wear service uniform or lounge suits; a minority wear morning coats, and in the evening, depending on the formality of the occasion, black tie or white tie.

During World War II, the palace was bombed nine times.

The most serious and publicized incident destroyed the palace chapel in 1940. This event was shown in cinemas throughout the UK to show the common suffering of rich and poor. One bomb fell in the palace quadrangle while King George VI and Queen Elizabeth were in the palace, and many windows were blown in and the chapel destroyed.

On 15 September 1940, known as the Battle of Britain Day, an RAF pilot, Ray Holmes of No. 504 Squadron RAF rammed a German Dornier Do 17 bomber he believed was going to bomb the Palace. Holmes had run out of ammunition and made the quick decision to ram it. Holmes bailed out and the aircraft crashed into the forecourt of London Victoria station.

On VE Day—8 May 1945—the palace was the centre of British celebrations. The King, the Queen, Princess Elizabeth (the future Queen), and Princess Margaret appeared on the balcony, with the palace's blacked-out windows behind them, to cheers from a vast crowd in The Mall. The damaged Palace was carefully restored after the war by John Mowlem & Co. It was designated a Grade I listed building in 1970.

Débutantes were aristocratic young ladies making their first entrée into society through a presentation to the monarch at court. These occasions, known as "coming out", took place at the palace from the reign of Edward VII. The débutantes entered—wearing full court dress, with three ostrich feathers in their hair—curtsied, performed a backwards walk and a further curtsey, while manoeuvring a dress train of prescribed length. The ceremony, known as an evening court, corresponded to the "court drawing rooms" of Victoria's reign. After World War II, the ceremony was replaced by less formal afternoon receptions, omitting the requirement court evening dress. In 1958, the Queen abolished the presentation parties for débutantes, replacing them with Garden Parties, for up to 8,000 invitees in the Garden. They are the largest functions of the year.

In November 2015, the State Dining Room was closed for six months because its ceiling had become potentially dangerous.

A 10-year schedule of maintenance work, including new plumbing, wiring, boilers, and radiators, and the installation of solar panels on the roof, has been estimated to cost £369 million and was approved by the prime minister in November 2016. It will be funded by a temporary increase in the Sovereign Grant paid from the income of the Crown Estate and is intended to extend the building's working life by at least 50 years. In March 2017, the House of Commons backed funding for the project by 464 votes to 56.

In the year to 31 March 2017, 580,000 people visited the palace, and 154,000 visited the gallery.