Skip to content

Text to Code Comment

Turn a block of text into a comment in any language, wrapped and aligned.

Direction

Quick Tool Overview

The Text to Code Comment tool wraps text into a comment in thirteen styles without ever breaking a word, indents every line including the markers, and reverses the operation to lift a commented-out block back into live code.

What it does
Formats text as a comment, or strips one
You give it
Text, a language style and a width
You get back
A properly wrapped comment block
Best for
Licence headers and long explanations
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the Text to Code Comment

Paste text and get it back as a properly formatted comment in thirteen styles, wrapped to a column, indented to match where it is going, and with a banner option for a section header. It works in reverse too, stripping the markers back off.

It sounds like a small thing, and it is — right up until you are pasting a licence header into forty files, or reformatting a paragraph of explanation that has drifted past column 120 and now wraps badly in everyone’s editor. The wrapping never breaks a word in half, the indentation is applied to every line including the markers, and the reverse direction is the quickest way to lift a commented-out block back into live code.

Key features of the Text to Code Comment

Thirteen styles

Every common line and block form, plus JSDoc, Python docstrings, Ruby =begin and Lua long comments.

Wrapping that respects words

Text is broken at spaces to the column you choose, with the marker width counted in.

Banner mode

A ruled box for a section header, optionally centred.

Indentation applied throughout

So the block drops into a nested scope already aligned.

Reverse direction

Strips markers, leading asterisks and the indentation they came with, leaving the text.

How to use the Text to Code Comment

  1. 1

    Paste your text

    A sentence, a paragraph or a whole licence header.

  2. 2

    Choose a style

    Thirteen, covering every common language plus JSDoc and Python docstrings.

  3. 3

    Set the width and indent

    Text is wrapped to the column without breaking a word.

  4. 4

    Copy it in

    Or switch direction to strip the markers off an existing comment.

Frequently asked questions

Match whatever the file already uses — 80 and 100 are the usual choices, 120 in codebases with wide monitors in mind. A comment that wraps differently from the code around it is what people notice.

Reviews of the Text to Code Comment

What people who use the Text to Code Comment think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the Text to Code Comment. It takes half a minute and no account.

Write the first review

More developer tools