Is there a secret color code hidden on the ends of toothpaste tubes that tells you if it the toothpase contains chemicals or other ingredients? No, that's not true: the colored squares or rectangles on toothpaste tubes are just a marking that is used by the machines used to fill toothpaste tubes, it has no relation to the composition or ingredients of the toothpaste.
An example of the "secret code" can be seen in from this video (archived here) where it was published by Jersey Demic on July 24, 2016 under the title "Secret behind Toothpaste". It claimed these colors corresponded with these ingredients:
BLACK = PURE CHEMICAL
RED = NATURAL + CHEMICAL COMPOSITION
BLUE = NATURAL + MEDICINE
GREEN = NATURAL
There are other versions of the hoax making the rounds with codes in a different order:
green: all natural
blue: natural plus medicine
red: natural and chemical
black: pure chemical
Or:
It is never made exactly clear what "natural" and "chemical" mean in this context, and what kind of "medicine" is meant exactly. And that is because the entire thing is a hoax. Colgate has helpfully put up an article explaining what is really going on:
What Does the Toothpaste Color Code Mean? | Colgate® Oral Care
Social media and the internet in general can be full of useful information. However, it can be just as easy to come upon stuff that's completely made up. One hoax that has been making the rounds has to do with toothpaste and the colorful markings you see on the bottoms of the tubes.
Specifically:
The reason for the marks has to do with how toothpaste tubes are made. The marks help light sensors detect the end of the tube, so that the machines used to prepare the tubes knows where to cut or seal them.
You can see a toothpaste-tube machine in action in this video clip:
And if you really want to know what is in your toothpaste tube, just read the ingredients list that is legally required to be present on the packaging (and yes, the U.S. Food and Drug Administration considers toothpaste to be a cosmetic):
Summary of Cosmetics Labeling Requirements
Cosmetics marketed in the United States, whether manufactured here or imported from abroad, must be in compliance with the provisions of the Federal Food, Drug, and Cosmetic Act (FD&C Act), Fair Packaging and Labeling Act (FP&L Act), and the regulations published under the authority of these laws.