Born the son of Admiral Alan Gardner, 1st Baron Gardner, he followed his father into the Royal Navy. In 1796 he was captain of the frigate , in 1802 he was captain of "Resolution", and in 1805 of the 74-gun – in the latter he was present at the action off Ferrol in 1805, and led the vanguard at the Battle of Cape Finisterre later that year.