Rewrite Anything

Generate a Docstring

Turn any function into properly formatted documentation with a docstring. Free, no signup required.

Rewritten
def slugify(title): """Convert a title into a URL-safe slug. Args: title (str): The text to convert. Returns: str: A lowercased, hyphenated slug with surrounding whitespace removed. """ return title.lower().strip().replace(' ', '-')

About this tool

A docstring is the documentation that lives with a function — describing its purpose, parameters, and return value in the format your language expects, so IDEs and doc generators can surface it. Unlike a quick inline comment, a docstring is structured and complete. This tool reads a function and produces a docstring matching the conventions of its language, whether that's a Python triple-quoted block, a JSDoc comment, or something else. It's built for the moment you've finished a function and need to document it properly before it becomes part of a shared API surface.

Frequently asked questions

How is this different from the code comment tool?+

A comment is a short freeform note; a docstring is structured documentation with parameter and return descriptions in your language's standard format.

Does it follow my language's docstring style?+

Yes — it uses the conventional format for the language it detects, such as Google/NumPy style for Python or JSDoc for JavaScript.

Will the parameter descriptions be accurate?+

It infers them from the code and names, which is usually accurate, but review anything ambiguous — it can only describe what the code makes visible.

Related code tools