Retired Rear Adm. John B. Heffernan, 83, a veteran of both world wars and a Navy historian, died Monday at Bethesda Naval Hospital following brain surgery.

In World War II, he commanded the screen of destroyers protecting the Allied invaders of North Africa at Casablanca in 1942.

Later in the war, Adm. Heffernan was sent to the Pacific, where he commanded a division of five transports in the assault on Guam. He then was chief of staff or a service squadron operating in the forward area.

In the last year of the war, he commanded the battleship USS Tennessee, which had been damaged in the attack on Pearl Harbor but was put back in action. The Tennessee participated in the battles of the Leyte Gulf, Surigao Strait, Iwo Jima and Okinawa.

His decorations in World Warr II included two Legions of Merit and three Bronze Stars.

Adm. Heffernan spent his last 10 years of active duty before retiring in 1956 as director of naval history at the Navy Department here. He supervised the preparation and publication of the definitive history of U.S. Navy operations in World War II written by the late Rear Adm. Samuel Eliot Morison.

Born in Washington, Ind., Adm. Heffernan graduated from the Naval Academy at Annapolis in 1917 and served on destroyers throughout World War I.

In the early 1920s, he was press information officer at the Navy Department and a naval aide at the White House. He was with President Warren G. Harding's party when the president died in San Franciso in 1923.

Adm. Heffernan's assignments also included tours as an instructor in history at the Naval Academy during 1932-33 and 1938-40.

Beginning in June 1940, he served for 30 months as commander of a destroyer division and of a destroyer squadron on North Atlantic convoy duty and with the first expedition to Iceland.

After he retired from military duty, Adm. Heffernan served for several years as secretary of the Navl Historical Foundation and as naval editor of the Encyclopedia Britannica.

He wasa member of numerous historical associations and societies. He also was a Knight of the Holy Sepulcher and a Fourth Degree Knight of Columbus.

He is survived by his wife, Patricia Gratton Esmonde Heffernan, of the home in Washington; a daughter, Patricia G., and a son, the Rev. Henry G. Heffernan, S.J., both of Washington; two other daughters, Eithne M. Hartnett, of Pittsburgh, and Kathleen B. Wach, of Khartoum, Sudan; two sisters, Margaret Hyatt, of Washington, Ind., and Eileen Heineman, of Connersville, Ind., three brothers, Joseph V., of New York, Daniel W., of Evansville, Ind., and Robert E., of Hyattsville, and 12 grandchildren.