A rule? Not necessarily, however, there are conventions you should look towards when choosing whether to write the numeric value of a number or its written form. Note that some of these do not apply to scientific papers, math papers, etc.
Below are some that I can think of off the top of my head:
Don't ever start a sentence with the numeric value of a number. It is almost never a good idea. If the sentence must start with a number that is possible to write - under ten letters - you should write it out. If this is not the case, try to reformat the sentence in a way that doesn't change its context/message.
Which leads to the second bullet: it's quite common to write the numeric value of a number if the number itself is under ten. Why? It's simple, writing the number eight is far less straining on the reader than writing say one-hundred-thousand-sixty-eight. See those dashes? Avoid them!
The convention above should be ignored when writing out centuries. Generally you should you be writing them out ex. eighteenth century.
DO NOT put two numbers right next to each other. It is bad practice and should generally be avoided at all cost.
If you're in need of a more credible source feel free to check out OwlPurdue for writing style/mechanics/conventions