Be careful not to confuse these two words with the similar-looking demonstrative pronouns dieselbe etc. described in the previous section. The meaning of either word is determined by its position in the sentence.
When selbst precedes the noun or phrase to which it relates, then it has the emphatic meaning "even", as an adverb:
Selbst der Direktor hat das nicht gemerkt.
Even the director did not notice that.
Selbst Haifische fressen Quallen nicht.
Even sharks don’t eat jellyfish.
Ich kaufe mir keine Lotteriekarten, selbst wenn der Jackpot groß ist.
I won’t buy lottery tickets even if the jackpot is big.
In other positions, selbst is completely equivalent to selber, that is, a demonstrative pronoun translated as a “-self” word. In this meaning, you again need to pay close attention to position in the German sentence. When it immediately follows an object, then it’s emphasizing that object, just like in English when you place a "-self" word immediately after an object:
Die Lehrerin selber hat das Buch geschrieben.
The teacher herself wrote the book. (This emphasizes that the teacher wrote it).
Die Lehrerin hat das Buch selber geschrieben.
The teacher wrote the book herself. (This emphasizes that the teacher wrote it herself.)
Den Kuchen habe ich selbst gebacken.
I baked the cake myself.