International audienceComma-free codes have been widely studied in the last sixty years, from points of view as diverse as biology, information theory and combinatorics. We develop new methods to study comma-free codes achieving the maximum size, given the cardinality of the alphabet and the length of the words. Specifically, we are interested in counting the number of such codes when all words have length 2, or 3. We first explain how different properties combine to obtain a closed-formula. We next develop an approach to tackle well-known sub-families of comma-free codes, such as self-complementary and (generalisations of) non-overlapping codes, for which the aforementioned properties do not hold anymore. We also study codes that are not c...