What does it really mean for a formal system to be consistent? As far as I understand, asserting that a formal system $T$ is consistent means that there does not exist a sentence $\varphi$, expressed in the language of $T$, such that $T$ proves $\varphi$ and $T$ proves $\neg\varphi$. This definition of consistency makes sense on an intuitive level, but it invites the question: in what metatheory is the sentence "there does not exist a $\varphi$ such that $T$ proves $\varphi$ and $T$ proves $\neg\varphi$" expressed?
It often seems that people consider some formal systems to be consistent in a Platonic sense, and they are not making a claim about any particular metatheory. For example, many logicians really believe in the consistency of, say, Peano Arithmetic. However, can this idea be made sense of from a formalist point of view?
 A: An absolute formalist viewpoint is untenable, because of the intrinsic and inescapable circularities in fundamental concepts. However, the basic concepts that one needs to accept in order to have a sensible notion of consistency are very simple. In fact, it suffices to accept only finitistic properties of finite binary strings, captured by TC (theory of concatenation), since it is easy to talk about finite sequences of finite strings in TC, and the encoding is natural and does not require any additional philosophical assumptions. In fact, TC suffices for expressing such statements about all kinds of formal systems, as sketched here (under "Encoding program execution in a string").
Note that TC is weaker than PA, and in fact PA proves an arithmetical sentence that expresses the consistency of TC (using Godel coding). Thus it is actually sensible to work within TC and reason about Con(PA) (or Con(TC) for that matter) without already assuming something that is strong enough to prove Con(PA). And as per what I said above, I want to emphasize that Con(PA) here is some sentence over TC that undeniably expresses consistency of PA without any need for further philosophical assumptions, in contrast to arithmetical sentences involving Godel coding.
In standard literature, you would see a different focus, on theories of arithmetic instead, especially in reverse mathematics. See this post on building blocks for some philosophical discussion about some of the principles involved. Expressing consistency over RCA0 does not require Godel coding (since pair-coding suffices to encode a finite string as a finite set of pairs).
TC is essentially the weakest possible meta-system that you need to make sense of syntax, not to say consistency statements. RCA0 is slightly stronger, but if you accept RCA0 then check the proof of Godel's β-lemma ("Representability Theorem" in Rautenberg) to see that it can be expressed and proven within RCA0, and hence you can also accept Godel coding. So assuming RCA0, it becomes sensible to consider the arithmetical sentences expressing consistency statements via Godel coding to be meaningful. Not coincidentally, many fundamental results in logic can be proven in a related system called IΣ1 (which is PA− plus Σ1-induction), assuming Godel coding. PA− and TC are roughly as strong, and more or less corresponds to strict finitism. IΣ1 more or less corresponds to PA− plus finitistic induction, as described in this post.
