|• Total||3.83 km2 (1.48 sq mi)|
|• Density||760/km2 (2,000/sq mi)|
During the Middle Ages, an Old Prussian fort called Malcekuke, loosely translated as "woods of the subterraneous" or "devil's ground", was located near the current site of Pieniężno. This was linguistically corrupted by German settlers to Mehlsack, meaning "flour sack", and then by Poles to Melzak. In the 14th century it was founded as a town west of Heilsberg (Lidzbark Warmiński) in Warmia.
The town's coat of arms depicts three bags of flour spaced in between a golden sword and a silver key, all on a blue background. The website recalls a story that the inhabitants defied a Swedish siege in the 17th century by spilling their last sack of flour as a deception to convince them that they still had plenty of food left.
The Teutonic Knights built an Ordensburg castle near Malcekuke in 1302. Both the castle and the town which developed nearby were destroyed during warfare between the Teutonic Order and the Kingdom of Poland in 1414. During the Thirteen Years' War, Mehlsack surrendered to the Order, and the castle burned down during Poland's recapture of the town. Nicolaus Copernicus was an administrator for the districts of Allenstein (Olsztyn) and Mehlsack for a few years in the early 16th century. From October 1518 - March 1519 Copernicus was based out of the castle while he settled nearby villages. From 1589-1599, Prince Andrew Cardinal Báthory of Transylvania, cousin of Sigismund Báthory, was the administrator for the castle. In 1550, the Prussian army laid siege to the city and partially burned it down.
The town was captured by Swedish troops in 1626 during the Polish-Swedish War of 1625-29, recovered by Hetman Stanisław Rewera Potocki, and then had its castle partially destroyed by Swedish troops in 1627. The town hall, dating from the 14th century and rebuilt in the 15th century, was destroyed during the Swedish occupation in 1626. It was rebuilt in 1666, but burnt in a fire the same year, only to be rebuilt again in 1770. The castle was restyled in 1640 with Baroque gables, and its function changed from being a fortress to being a château.
The town was annexed by the Kingdom of Prussia during the First Partition of Poland in 1772, and administered in the Province of East Prussia the following year. It became part of the German Empire in 1871 during the Prussian-led unification of Germany.
During the 19th and 20th centuries the castle lost some of its Gothic and Baroque features, and in 1870 its eastern and southern wings were demolished after extensive deterioration. The remainder of the castle was used as administrative offices for Prussian officials. From 1920-31 the western wing was renovated so the castle could be used as a school and museum.
In 1945, near the end of World War II, Mehlsack, including its castle, was 90 per cent destroyed by fighting and was conquered by the Soviet Red Army. The town was placed under Polish administration under border changes promulgated at the postwar Potsdam Conference. The remaining German-speaking residents were expelled and replaced with Poles, many of whom had themselves been expelled from Polish areas annexed by the Soviet Union.The town was renamed from Mehlsack to Pieniężno after Seweryn Pieniężny (1852-1894), an editor for the Polish-language newspaper Gazeta Olsztyńska in Olsztyn (then Allenstein, East Prussia, Germany).