His success was rapid, and in a few years he attained a position at the bar second only to that of Henry Brougham and James Scarlett. He distinguished himself by his defence of the Luddites; but his most brilliant appearance was as one of the counsel for Queen Caroline. His speech before the House of Lords was very powerful, and some competent judges even considered it not inferior to Brougham's. It contained one or two daring passages, which made the King his bitter enemy, and retarded his legal promotion. Unfortunately he made a notable gaffe when he compared the Queen to the Biblical woman taken in adultery, who was told to "go away and sin no more". This suggested that her counsel had no belief in the Queen's innocence, and produced the mocking satire: "Most Gracious Queen, we thee implore To go away and sin no more Or if that effort be too great To go away at any rate".
At the general election of 1818 he was returned Member of Parliament for Wareham, and at once took his seat with the Whig opposition. In the following year he was returned for Nottingham, which seat he represented until 1826 and again from 1830 until his elevation to the bench in 1832. His liberal principles had caused his exclusion from office till in 1822 he was appointed Common Serjeant of London by the corporation of London. In 1830 he was made Attorney General under Lord Grey's administration and was knighted on 24 November that year. Two years later he was made Lord Chief Justice of the King's Bench and was sworn of the Privy Council two days later. In 1834, he was raised to the peerage as Baron Denman, of Dovedale, in the County of Derby. As a judge he is best remembered for his decision in the important privilege case of Stockdale v. Hansard. In 1841 he presided, as Lord High Steward, over the trial in the House of Lords of the Earl of Cardigan for attempted murder. In O'Connell v the Queen, in 1844, he led the majority of the Lords in quashing the conviction for sedition of Daniel O'Connell. This is a tribute to his integrity since O'Connell was regarded with aversion by the British ruling class; but Denman, as he made clear, could not accept that he had received a fair trial. In 1850 he resigned his chief justiceship and retired into private life. He was a Governor of the Charter House, and a Vice-President of the Corporation of the Sons of the Clergy. He also strove with great energy, both as a writer and as a judge, to effect the abolition of the slave trade.