A previous Custom House had been built in 1707 by engineer Thomas Burgh (1670–1730). However, by the late 18th century it was deemed unfit for purpose.
The building of a new Custom House for Dublin was the idea of John Beresford, who became first commissioner of revenue for Ireland in 1780. In 1781 he appointed James Gandon as architect, after Thomas Cooley, the original architect on the project, had died. This was Gandon's first large scale commission. The new Custom House was unpopular with the Dublin Corporation and some city merchants who complained that it moved the axis of the city, would leave little room for shipping, and it was being built on what at the time was a swamp. Purchase of land was delayed and proved exorbitant and the laying of foundations was disrupted by the High Sheriff and members of the Dublin Corporation with a mob of several thousand. However, Beresford was determined to complete the project and ignored the protests.
Construction started in 1781, and for his assistants Gandon chose Irish artists such as Meath stone-cutter Henry Darley, mason John Semple and carpenter Hugh Henry. Every available mason in Dublin was engaged in the work. When it was completed and opened for business on 7 November 1791, it had cost £200,000 to build – a considerable sum at the time. The four facades of the building are decorated with coats-of-arms and ornamental sculptures (by Edward Smyth) representing Ireland's rivers. Another artist, Henry Banks, was responsible for the statue on the dome and other statues.
As the port of Dublin moved further downriver, the building's original use for collecting custom duties became obsolete, and it was used as the headquarters of the Local Government Board for Ireland. During the Irish War of Independence in 1921, the Irish Republican Army burnt down the Custom House, in an attempt to disrupt British rule in Ireland. Gandon's original interior was completely destroyed in the fire and the central dome collapsed. A large quantity of irreplaceable historical records were also destroyed in the fire. Despite achieving its objectives, the attack on the Custom House was a setback for the IRA as a large number of Volunteers were captured either during the attack or when falling back.
After the Anglo-Irish Treaty, it was restored by the Irish Free State government. The results of this reconstruction can still be seen on the building's exterior today – the dome was rebuilt using Irish Ardbraccan limestone which is noticeably darker than the Portland stone used in the original construction. This was done as an attempt to promote Irish resources.
Further restoration and cleaning of the stonework was undertaken by an Office of Public Works team in the 1980s.