Difference between '#' and ';' characters in platformio.ini file comments

I was wondering what was the difference between these characters when doing comments, because both are ignored when building a project, right?

As per documentation "; " should be used for comments.

It seems that “#” is also accepted.
To be on the safe side, follow the specification provided in the documentation.

Technically there’s a slight difference:

So while both ; and # are comments, inside a single item, only the ; functions always as a comment.

Say e.g. you want to reference a certain branch of a github repo with

lib_deps =

Then the # is not interpreted as a comment start but rather the branch name. If it were a ;, it would just reference https://github.com/myuser/myrepo.git. So, by using only ; as the comment character, you’re on the safe side.


Nice. I read before in documentation that " ; " is used for comments, I was just wondering why not " # " too :grinning: