How can I center a too wide table?

If a table (or any other horizontal box) is wider than the text (\textwidth) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than \textwidth. The \makebox macro with its two optional argument for the width and horizontal alignment can be used for this: \makebox[\textwidth][c]{<table>} will center the content. See Center figure that is wider than \textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.

For more complicated tables, especially if they should contain verbatim material, you should use a different approach. \makebox reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The \Makebox macro or the Makebox environment from the realboxes can be used as an replacement. It reads the content as a box. Better would be the adjustbox macro or environment from the adjustbox package together with the center key.

\begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
\end{adjustbox}

Which centers the content to \linewidth (mostly identical to \textwidth) by default but also takes any other length as an optional value, e.g. center=10cm. Note that <your table> should be a tabular or equivalent environment, not a table environment.


You can now also use the tabular key of adjustbox (as first key!) to save the extra \begin{tabular} .. \end{tabular} which is then added internally.

\begin{adjustbox}{tabular=lll,center}
     a & b & c \\
     a & b & c \\
     a & b & c \\
\end{adjustbox}

Put your table into \centerline{}. The table will extend evenly into both margins if it's wider than \textwidth.


I’ve seen that an answer based on the use of \centerline has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{mwe} % facilitates the writing of Minimale Working Examples like 
                 % this one, not to be used in actual documents



\begin{document}

\lipsum[1]
\begin{center}
    \addtolength{\leftskip} {-2cm} % increase (absolute) value if needed
    \addtolength{\rightskip}{-2cm}
    \begin{tabular*}{1.2\textwidth}{@{\extracolsep{\fill}}|ccc|}
        \hline
        Does & this & table  \\
        really & need & to  \\
        be & so & wide?  \\
        \hline
    \end{tabular*}
\end{center}

It works with floating objects, too: see, for example, figure~\ref{fig:a} and
table~\ref{tab:b}.

\begin{figure}[tbp]
    \centering
    \addtolength{\leftskip} {-2cm}
    \addtolength{\rightskip}{-2cm}
    \includegraphics[width=1.2\textwidth,height=5cm]{image}
    \caption{A example image}
    \label{fig:a}
\end{figure}

\begin{table}[bp]
    \centering
    \addtolength{\leftskip} {-2cm}
    \addtolength{\rightskip}{-2cm}
    \begin{tabular*}{1.2\textwidth}{@{\extracolsep{\fill}}|ccc|}
        \hline
        And & what & about  \\
        this & one, & eh?  \\
        \hline
    \end{tabular*}
    \caption{An example table}
    \label{tab:b}
\end{table}

\lipsum[2]

\end{document}

This is the output:

Output of the above code