I have done some search for margin alignment in Latex but cannot find how can I right-align any single line?

For example, in a letter sometimes we put a Sincerely on the right. But without using specific documentclass, how can I align any single line in a paragraph to the right in any documentclass?

Many thanks for the help!

  • 6
    Have you tested with \rightline{text}?
    – skpblack
    Aug 11, 2014 at 4:06
  • 1
    Have you looked into using \raggedleft?
    – Mico
    Aug 11, 2014 at 4:35

4 Answers 4


Like this?


\hspace*{\fill} Yours sincerely

This is some more text

\null\hfill Yours sincerely

Again some dummy text

\hspace*{0pt}\hfill Yours sincerely

And again Phew

\mbox{}\hfill Yours sincerely

enter image description here

  • The way you write your answer might induce the idea that \par is necessary. I'd simply propose the <blank line> \hspace*{\fill} <text> solution.
    – egreg
    Aug 11, 2014 at 9:13
  • @egreg Oh! Sorry. I wanted it to be a new line and I preferred \par over `\\` I changed it. Thanks.
    – user11232
    Aug 11, 2014 at 9:15
  • 4
    Can you clarify which of these options is the most appropriate in various situations? Or are they all identical? Mar 16, 2020 at 1:40

For a short line (With lenght less than \linewidth) you can use \rightline{word or phrase}.

If you want to align a paragraph at right put it in a flushright environment. This way allows line breaks with \\.

aligned to\\
the right.

The simpler solution to right align a line is this:


Here comes some text.
Have a nice day.

\rightline{Yours sincerely}

  • 1
    This is a neat solution (thanks!). I wonder why it has not gotten many upvotes.
    – psyguy
    Sep 13, 2022 at 14:20

This will work if the right-aligned content is considered a separate paragraph (i.e., it will have \parskip separation). Note that it will have less vertical separation than a flushright environment.

{\raggedleft Sincerely,\par}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .