How are (small) categories defined using set theory? A category consists of a collection of objects and a collection of morphisms such that any morphism has a specified domain and codomain, there is the identity morphism for every object and such that there is a composition of morphisms in the usual sense. In my opinion "consists of" and "collection" are a bit vague, so I wondered how this could possibly be defined in set theory. As you can read below, I tried translating "consists of" as an ordered pair and "collection" as set in the case of small categories.
Consider for example a group $G$. Then it is well known that this can be viewed as a category with one object such that any morphism is given by a group element $g \in G$ and that the composition of $g,h \in G$ is given by group multiplication $gh$. Being nit picking, this is not correct since group elements alone certainly don't specify a domain and codomain, even though the context suggests what the domain and codomain are supposed to be. Here we are dealing with a small category, so I wondered whether one could (or whether this is done) by using triples.
I am neither well educated in set theory nor in category theory, so this is probably a naive question and approach, but perhaps one could say that a small category $C$ is an ordered pair of sets $(\mathsf{Ob}(C),\mathsf{Mor}(C))$ where any element of $\mathsf{Mor}(C)$ is given by a triple $(X,Y,f)$, where $X,Y$ are elements of $\mathsf{Ob}(C)$ and $f$ is a set such that the usual axioms are satisfied. If this were possible, one would always have a specified domain and codomain. This could also easily make precise that the opposite category is given by the objects of $C$ and as morphisms the triples $(Y,X,f)$ whenever $(X,Y,f) \in \mathsf{Mor}(C).$
This is obviously not possible when dealing with larger categories, so I wonder: Is this one way to define small categories or is even this naive suggestion false? Either way, is there a common way to define categories (large or small) in $\mathsf{ZFC}$?
 A: Your speculations about how one can formalize the axioms of a category are kind of interesting, although they differ somewhat from the details of how that formalization is actually carried out.
Let me answer your question by filling out the details of the description of the category that is associated to a group.
As indicated in my comments, the formal definition of a small category requires not just a set of objects and a set of morphisms, but various functions must also be given which describe how the objects and morphisms interact with each other.
So, suppose we are given a group, consisting formally of a triple $(G,e,\star)$ where $G$ is a set, $e \in G$, and the group operation itself is
$$\star \,\, : \,\, G \times G \mapsto G
$$
To turn this into a small category $C$, the one missing element in the definition of a category that is not already staring us in the face is the set of objects: this will be a one point set which I shall denote $\mathsf{Ob}(C) = \{\mathcal O\}$.
The set of morphisms is already present: $\mathsf{Mor}(C) = G$.
You wrote

... If this were possible, one would always have a specified domain and codomain...

Well, that's exactly correct. The definition of a small category also requires one to give two functions named $\text{dom}$ and $\text{cod}$, each a function from $\mathsf{Mor}(C)$ to $\mathsf{Ob}(C)$. In our special case there is only one choice:
$$\text{dom}(g)=\text{cod}(g)=\mathcal O \quad\text{for each} \quad g \in G
$$
Next there's some notation: for any ordered pair of objects $a,b$ one defines $\text{hom}(a,b)$ to be the set of all $f \in \mathsf{Mor}(C)$ such that $\text{dom}(f)=a$ and $\text{cod}(f)=b$. In our special case, the only such ordered pair to be concerned with is $a=b=\mathcal O$, and clearly $\text{hom}(\mathcal O,\mathcal O) = G$.
The final thing required to be given in the definition of a small category is a function which inputs an ordered triple of objects $a,b,c$ and which outputs a "composition function"
$$\text{hom}(a,b) \times \text{hom}(b,c) \to \text{hom}(a,b)
$$
In our special case, we must have $a=b=c=\mathcal O$, and so there is only one composition function to be given, namely
$$\underbrace{\text{hom}(\mathcal O,\mathcal O)}_G \times \underbrace{\text{hom}(\mathcal O,\mathcal O)}_G \to \underbrace{\text{hom}(\mathcal O,\mathcal O)}_G
$$
Well, there's only one reasonable choice for this composition function, namely the group operation $\star$ itself.
That's basically it, although of course one must still walk through the axioms of a category and verify that they all hold for this special case, but I'll leave that to you.
Oh, maybe I forgot to specify that in a small category there is one more piece of data that must be given: a function that inputs a single object $\mathcal O$ and that outputs the identity element of its set of self-morphisms $\text{hom}(\mathcal O,\mathcal O)$. In our special case, the identity element of $\text{hom}(\mathcal O,\mathcal O) = G$ is ... well ... of course ... the identity element $e$ of the group $G$.

So, for some final words, one key feature of the definition of a category is that you are not required to say anything more about the nature of the elements $f \in \mathsf{Mor}(C)$, nor about their internal structure as sets or whatever, etc. etc. As in any good axiom system, all the definition of a category requires is that certain data be given (objects; morphisms; domains; codomains; composition operations; identity elements) and that this data obey certain properties (the axioms of a category).
