Of American-English origin, the phrase to judge a book by its cover, and its variants, mean to make assumptions about someone or something based on appearance or on superficial characteristics.
This phrase is chiefly used in negative contexts, as you can’t judge a book by its cover, don’t judge a book by its cover, etc.
The metaphor conveyed by the phrase occurs in the Preface to Truth in Fiction: Or, Morality in Masquerade. A Collection of Two hundred twenty five Select Fables of Æsop, and other Authors. Done into English Verse (London: Printed for J. Churchill, 1708), by Edmund Arwaker (died 1730):
I am sensible, that, with some, the very Name of Fables, is enough to bring any Work, to which it is prefix’d, into Contempt, as a thing of no Use or Value; or at best, but a Childish Entertainment […].
But, as a Man is not to be judg’d of by his Out-side, any more than a Book by its Title-Page; so Fables are not to be valu’d only as insipid Tales, composed to please Children, and make Fools laugh: For their Honey is not without a Sting, and they have something in them of Prevalency enough to make the Wise Consider.
These are, in chronological order, the earliest occurrences of to judge a book by its cover and variants that I have found—including literal uses of the phrase:
1-: From the Boston Daily Advertiser (Boston, Massachusetts) of Wednesday 29th August 1821:
In the Evening Gazette of last Saturday, I observed a notice of the 2d No. of the Idle Man, in which that work is said to be written on the plan of the Sketch Book […].
[…] If the writer of the article is to be considered, in this instance, as speaking after the manner of printers, the plan of the Sketch Book has indeed been followed to a considerable degree—the work appears in a cover of exactly the same colour—the paper is of the same whiteness and fineness—and the type is large, brilliant and beautiful. These circumstances are calculated to mislead a man who judges of a book by its outside show. It is, however, an old and true adage, that there is no trusting to appearances, and accordingly the identity of plan in the two works ends here.
2-: From the account of a debate at the Senate of New York, published in the New-York Commercial Advertiser (New York City, New York) of Saturday 11th February 1837:
Mr. Roosevelt thought it as ridiculous to presume fraud from the face of the petition, as to undertake to judge of a book from its title.
3-: From Books, published in The Light Ship (Boston, Massachusetts) of Wednesday 6th January 1847:
Judge not of a book by its size, for some pocket volumes contain really and intrinsically more than folios; the question should be the amount and kind of ore, and not the extent of the field that contains it.
4-: From The Northern Star, and Farmers’ and Mechanics’ Advocate (Warren, Rhode Island) of Saturday 1st July 1848:
I DON’T LIKE HIS LOOKS.
Why! Because I don’t. Powerful reasoning, is it not. But are you not guilty of the same sin? Have you not expressed your mind unfavorably towards an individual, with whom you had no acquaintance, because you were not so well pleased with his looks? Was it right?—You may as well judge of a book by its covering—a pearl by the shell in which it is found. The roughest looking men sometimes are the possessors of the kindest hearts and the noblest feelings. The homeliest man of our acquaintance is one of the finest fellows we ever met with. We once thought we did not care to number him among our friends; now we would not part with him. One of the plainest women we have seen is a meek and humble christian [sic], beloved by all who know her. We wish we could say as much for the handsome men and pretty women who walk our streets and fill our churches. The face is not the index of the heart. From the shell no one can judge of the meat. Pearls are as often picked from the dung hill as from the flower garden. Never then judge by looks alone, nor speak disrespectfully or unkindly of one who may not be beautiful to look upon. First become acquainted with the person, and then judge of the disposition and character, but never before.
5-: From The Boston Daily Mail (Boston, Massachusetts) of Tuesday 12th June 1849:
Don’t Judge a Book by its Cover.—The Courier says that some of the occupants of large and fashionable establishments on Washington street have been placed in a delicate position by the city ordinance which compelled them to clean out their yards and cellars. Some disclosures have been made, which, to say the least, were neither expected of hoped. We do not intimate that human bones were found; but things equally wonderful were. Over fifty cartloads of filth have been carried away from the cellar and yard of one of the most fashionable concerns on the street, and the premises are not decently clean yet.
6-: From Religion and Religionism, published in The New-York Evangelist and New-York Presbyterian (New York City, New York) of Thursday 29th August 1850:
The other day, while turning over some books at a bookseller’s, one with the following title fell under our eye: “Justorum Semita, or a History of the Holidays of the Church.” It was a London print, and the word Church was taken in the high Anglican Church sense.
We are not disposed to judge of a book merely by its title, for a title is often fancifully chosen. In this volume, however, the title seems to have been chosen to indicate at a glance, the character of the contents.
7-: From the review of Sabbath in the City and Home Lyrics (Boston: Benjamin B. Mussey and Company, 1854), by Washington Folsom Somerby—review published in The Citizen (New York City, New York) of Saturday 22nd July 1854:
The volume is very well printed, arrayed in clear type and white paper, gilt outside, and adorned with the portrait of the author. […] Whichever way we take it, we perhaps may be favorably struck with the appearance of the book, but it is an old proverb, that we must not be led away by appearance, and that we must never judge a book by its cover.
8-: From The Astor Library, published in the New Hampshire Statesman (Concord, New Hampshire) of Saturday 24th May 1856:
Within the limits of continental Europe, to say nothing of the immense number of books enclosed within the walls of the Bodleian Library and the British Museum, there are about forty libraries larger than the Astor. The number of books is, however, by no means a proof of the value of a library. We could with equal justice judge of a book by the number of pounds it weighs.