We consider the well-studied cake cutting problem in which the goal is to find an envy-free allocation based on queries from $n$ agents. The problem has received attention in computer science, mathematics, and economics. It has been a major open problem whether there exists a discrete and bounded envy-free protocol. We resolve the problem by proposing a discrete and bounded envy-free protocol for any number of agents. The maximum number of queries required by the protocol is $n^{n^{n^{n^{n^n}}}}$. We additionally show that even if we do not run our protocol to completion, it can find in at most $n^{n+1}$ queries a partial allocation of the cake that achieves proportionality (each agent gets at least $\frac{1}{n}$ of the value of the whole cake) and envy-freeness. Finally we show that an envy-free partial allocation can be computed in $n^{n+1}$ queries such that each agent gets a connected piece that gives the agent at least $\frac{1}{3n}$ of the value of the whole cake.