In code golfing questions it is tedious to copy-paste everyone's solution to see how long it is. Should having character counts for each submission be mandatory?

There are various examples of this all over the site, so I don't want to single anyone out.

  • \$\begingroup\$ I think one thing needs to be clarified - they should be mandatory iff code size is one of the criteria, we've got some anti-golfs on here as well... \$\endgroup\$ Jan 28, 2011 at 15:30
  • \$\begingroup\$ @tobyodavies: I agree, it would be stupid if it was not a shortness contest. \$\endgroup\$
    – JPvdMerwe
    Jan 28, 2011 at 19:45

3 Answers 3


It would be nice if we could get automated character count added as a feature. Then all code blocks could have a character count next to them and it would be irrefutable. It would also allow us to say for example later decide we don't want to consider whitespace in the count.

  • 2
    \$\begingroup\$ This would be much appreciated. \$\endgroup\$ Jan 28, 2011 at 0:38
  • 2
    \$\begingroup\$ whitespace should always be considered in the count, otherwise compsoc.dur.ac.uk/whitespace would have an unfair advantage. \$\endgroup\$
    – ninjalj
    Feb 5, 2011 at 10:06
  • \$\begingroup\$ @ninjaij That was just an example, one that could work if applied to a language such as C++. That aside, this question has said whitespace is ignored. Which as I commented there I don't believe will work. \$\endgroup\$
    – moinudin
    Feb 5, 2011 at 18:02
  • \$\begingroup\$ I made a script for this (/cc @dmckee) \$\endgroup\$
    – Doorknob
    Sep 25, 2013 at 21:18

I think they should be mandatory, because in the process of writing a shorter program you are constantly checking its size, so passing this information to the reader is not a big issue.

Additionally, I think a template for submissions could be in order, eg:

$LANGUAGE - $CHARS characters


  • \$\begingroup\$ This would make my UserScript work better. \$\endgroup\$ Feb 6, 2011 at 23:09

I think it's really important to include a character count. There have been many occasions with tight races between perl/python/ruby etc. And it's nice to be able to quickly check if you are still in the lead


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .