Let's start at the beginning of the modern system. (there is a older system)
The dan ranking system was invented by Honinbo Dosaku, professional go player in the Edo period. Prior to the invention, top-to-bottom ranking was evaluated by each handicaps and tended to be vague. He valued then highest title holder, Meijin at 9 Dan.
Dan ranks were applied to martial arts by Kano Jigoro, the founder of judo. Kano started the modern rank system when he awarded shodan (the lowest dan rank) to two of his senior students (Shiro Saigo and Tsunejiro Tomita) in 1883. Even then, there was no external differentiation between yūdansha (black belt ranks) and mudansha (those who had not yet attained a grade). Kano began the custom of having his yūdansha wear black obi (belts) in 1886. These obi were not the belts karateka and jūdōka wear today—Kano had not invented the jūdōgi (judo uniform) yet, and his students were still practicing in kimono. They wore the wide obi still worn with formal kimono. In 1907, Kano introduced the modern jūdōgi and its modern obi, with white and black belt ranks.
Mikonosuke Kawaishi is generally regarded as the first to introduce various colored belts in Europe in 1935 when he started to teach Judo in Paris. He felt that western students would show greater progress if they had a visible system of many colored belts recognizing achievement and providing regular incentives. This system included white, yellow, orange, green, blue, and purple belts before the traditional brown and black belts.
The modern ranking system
6th grade rokyu
5th grade gokyu
4th grade yonkyu
3rd grade sankyu
2nd grade nikyu
1st grade ikkyu
1st degree shodan
2nd degree nidan
3rd degree sandan
4th degree yodan
5th degree godan
6th degree rokudan
7th degree shichidan
8th degree hachidan
9th degree kudan
10th degree judan
Theoretically the Judo rank system is not limited to 10 degrees of black belt. The original english language copy (1955) of Illustrated Kodokan Judo, by Jigoro Kano, says: "There is no limit...on the grade one can receive. Therefore if one does reach a stage above 10th dan... there is no reason why he should not be promoted to 11th dan." However, since there has never been any promotion to a rank above 10th dan, the Kodokan Judo promotion system effectively has only 10 dans. There have only been 15 10th dans awarded by the Kodokan in the history of Judo.
The Judo practice uniform and belt system eventually spread to many of the other modern martial arts, such as aikido and karate.
1600s (late) kyu/dan grading system started with Go, a game.
1883 - Judo instututes dan system - first shodan
1885 - kendo, Tokyo Metropolitan Police Department uses kyu system
1907 - Judo institutes black belt system
1908 - kendo, the Tokyo Higher Normal School first used dan
1917 - Kyu/Dan system stanardized in Kendo
1924 - Karate's first black belts
1931 - Aikido adopts dan system
1935 - colored belts in judo
Much of this blog was taken from...