This paper introduces the R package sgmcmc; which can be used for Bayesianinference on problems with large datasets using stochastic gradient Markovchain Monte Carlo (SGMCMC). Traditional Markov chain Monte Carlo (MCMC)methods, such as Metropolis-Hastings, are known to run prohibitively slowly asthe dataset size increases. SGMCMC solves this issue by only using a subset ofdata at each iteration. SGMCMC requires calculating gradients of the loglikelihood and log priors, which can be time consuming and error prone toperform by hand. The sgmcmc package calculates these gradients itself usingautomatic differentiation, making the implementation of these methods mucheasier. To do this, the package uses the software library TensorFlow, which hasa variety of statistical distributions and mathematical operations as standard,meaning a wide class of models can be built using this framework. SGMCMC hasbecome widely adopted in the machine learning literature, but less so in thestatistics community. We believe this may be partly due to lack of software;this package aims to bridge this gap.