The Swiss confectionary company was seeking to protect the particular shape of its four-fingered chocolate bar in the UK.
But the Court of Appeal ruled on Wednesday that the design lacked the "distinctive character" to be registered as a trade mark – meaning Nestlé can't take legal action against companies copying the shape.
Nestlé has been arguing a case against rival Cadbury in the UK courts since 2013.
The three Court of Appeal judges confirmed the findings of lower courts in the case, saying that while KitKat's shape may be recognisable to consumers, that was not enough to make it registrable as a trade mark; it was also necessary to show that consumers needed the shape to identify the product.
The court noted that KitKat had not used the unwrapped chocolate bar in its marketing in many years, focusing more on the opaque outer packaging.
Mark Corran from London intellectual property law firm Briffa said that, beyond chocolate, the case demonstrated the difficulties facing any product designer wanting to trade mark a shape.
"For product designers, it highlights the difficulty of being able to argue that the shape of their products have become registrable per se as trade marks," he said. "While it is possible, generally speaking, it remains a high hurdle."
Trade marks safeguard brands from copycats. Unlike design rights, which arise automatically and protect new designs for a limited period, trade marks need to be registered. Names, words, phrases and logos are the most common trade marks.
The ruling means that other producers can now sell their own four-fingered KitKat-style bars in UK shops.
The verdict goes against a European Union General Court ruling from late 2016, which, while denying KitKat a registered trade mark throughout the EU, did find that that the bar had acquired "distinctive character through use" specifically in the UK.
Corran said that the case suggested that trade mark protection might be harder to come by in the UK post-Brexit.
"This kind of decision indicates the ways in which UK law might start to diverge from the EU's following Brexit," he said. "In the future, it may in some respects be harder to obtain registered protection for 3D shape marks in the UK than the EU."
"In an earlier decision, the EU General Court agreed with the EU Intellectual Property Office Board of Appeal that the mark had acquired distinctiveness in the UK, which is at odds with the decision in this case, suggesting that the threshold to acquire distinctiveness in the UK is, generally, higher than must be demonstrated for an EU trade mark – although, for an EU trade mark, it would be necessary to show that the mark has acquired distinctiveness in all member states."
The Court of Appeal's Lord Justice Kitchin said that while he accepted that the EU General Court's decisions were binding, it had not "made any such decision which is relevant to this appeal".
Nestlé has one more chance to secure a UK trade mark for the shape, if it chooses to bring an appeal to the Supreme Court. A spokesperson for the company said an appeal was under consideration.
"Nestlé is disappointed by the Court of Appeal judgment and is considering its next steps," a company spokesperson told the Guardian. "KitKat is much loved around the world and its four-finger shape is well known by consumers."
"Nestlé's four-finger shape has been granted trade mark registration in many countries of the world, for instance Germany, France, Australia, South Africa and Canada, further protecting it from imitations."
KitKat actually began life in the UK in 1935 as Rowntree's Chocolate Crisp, a snack that "a man could take to work in his pack up". It was renamed Kit Kat in 1937 and acquired by Nestlé in 1988.
Among the few chocolate bars to be recognised as a shape mark is Toblerone, from Cadbury owner Mondelēz. The company recently faced consumer outrage when it razed some of the bar's signature peaks, earning it the label "austerity Toblerone".
Cadbury also has another previous trade mark win over Nestlé from 2012, when it obtained exclusive rights to its signature wrapper colour, Pantone 2685C purple.
Top KitKat image by Jules Crompton from Flickr.