The formula, in general
logb M = logc Mlogc b
Any legal new base c works, so in practice you only ever need the two on your keypad:
logb M = log Mlog b = ln Mln b
Which one goes on top? The argument rides on top; the old base sinks to the bottom. Same order as the words: logb M reads bottom‑then‑top, so the fraction flips it back — M over b.
The trap. A quotient of two logs is not the log of a quotient. Check it: log 8 ÷ log 2 = 0.9031 ÷ 0.3010 = 3, but log(8 ÷ 2) = log 4 ≈ 0.6021. Those are nowhere near each other. (The 3 is no accident — it is log2 8, exactly what change of base promises.) You also cannot “cancel the logs.”
Excluded values. Every base must satisfy b > 0, b ≠ 1 and c > 0, c ≠ 1, and the argument must satisfy M > 0. The condition b ≠ 1 is exactly what keeps the denominator alive: logc 1 = 0, so a base of 1 would put a 0 in the bottom.