Non-malleable codes were introduced by Dziembowski, Pietrzak and Wichs as an elegant relaxation of error correcting codes, where the motivation is to handle more general forms of tampering while still providing meaningful guarantees. This has led to many elegant constructions and applications in cryptography. However, most works so far only studied tampering in the split-state model where di erent parts of the codeword are tampered independently, and thus do not apply to many other natural classes of tampering functions. The only exceptions are the work of Agrawal et al, which studied non-malleable codes against bit permutation composed with bit-wise tampering, and the works of Faust et al and Ball et al, which studied non-malleable codes against local functions. However, in both cases each tampered bit only depends on a subset of input bits.In this work, we study the problem of constructing non-malleable codes against more general tampering functions that act on the entire codeword. We give the rst e cient constructions of nonmalleable codes against AC 0 tampering functions and a ne tampering functions. These are the rst explicit non-malleable codes against tampering functions where each tampered bit can depend on all input bits. We also give e cient non-malleable codes against t-local functions for t = o( √ n), where a t-local function has the property that any output bit depends on at most t input bits. In the case of deterministic decoders, this improves upon the results of Ball et al, which can handle t ≤ n 1 4 . All our results on non-malleable codes are obtained by using the connection between non-malleable codes and seedless nonmalleable extractors discovered by Cheraghchi and Guruswami. Therefore, we also give the rst e cient constructions of seedless non-malleable extractors against AC 0 tampering functions, t-local tampering functions for t = o( √ n), and a ne tampering functions.To derive our results on non-malleable codes, we design e cient algorithms to almost uniformly sample from the pre-image of any given output of our non-malleable extractor.