Skip to content

Rough.js

A small JavaScript library that draws shapes in a sketchy, hand-drawn style on Canvas or SVG.rough-stuff/rough

Stars
21.3k
Forks
670
Licence
MIT
Language
HTML
Last update
2.3 years ago
Type
Library

No commits in over a year — check for forks or alternatives before adopting.

What it is

Rough.js is a small JavaScript graphics library that makes lines, shapes, and paths look hand-drawn instead of perfectly computer-drawn. It works with both HTML Canvas and SVG, so it can be added to a web page to produce diagrams or illustrations with a sketchy look. The README describes it as under 9 kB in size.

  • Draw rectangles, circles, ellipses, and lines with a sketchy outline on a web page
  • Fill shapes with hachure, zigzag, cross-hatch, dots, or solid patterns
  • Render SVG paths in a hand-drawn style
  • Adjust roughness and bowing to change how sketchy the output looks

Great for

  • Web developers who want a casual, hand-drawn look for diagrams or illustrations
  • Developers building whiteboard-style or sketch-style interfaces
  • People creating maps or charts that should look informal
  • Projects that need a lightweight drawing library with no heavy dependencies noted in the README

Not ideal for

  • People who need precise, technical, or CAD-style drawings, since the output is intentionally rough
  • Users who want a ready-made drawing app rather than a code library, since the README covers only the library API
  • Non-programmers looking for a point-and-click tool
Step-by-step guide: how to use Rough.jsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js and npm, if installing from npm

    Install from npm

    npm install --save roughjs
  2. 2

    Run it

    • Install the package with npm or load the script from unpkg.
    • Add a canvas or SVG element to your HTML page.
    • Create a rough canvas or rough svg object from that element.
    • Call a drawing method such as rectangle or circle to see the sketchy output.
  3. 3

    Get the most out of it

    • Use the fill option with fillStyle values such as zigzag or cross-hatch to change the texture.
    • Tune roughness and bowing to control how sketchy the lines look.
    • Use the path method with SVG path strings for custom shapes.
    • Use the simplification example from the README to render complex outlines such as maps.
    • Check the wiki for the full API reference linked in the README.

Downloads

Strengths

  • Small library size, described as under 9 kB in the README
  • Works with both Canvas and SVG output
  • Simple API with examples for shapes, fills, and paths

Trade-offs

  • The README is brief and points to an external wiki for full API documentation
  • Output is deliberately imprecise, so it is unsuited to exact measurements
  • The README shows no information on browser support or the maintenance pace beyond the last push date

How it compares

ProjectStarsTypeLevelUpdatedBest for
rough (this)21.3kLibraryintermediate2.3 years agoWeb developers who want a casual, hand-drawn look for diagrams or illustrations
excalidraw135kAppbeginner4 days agoTeams sketching diagrams or wireframes together in a shared canvas
Handy37kAppbeginner4 days agoPeople who want dictation without sending their voice to a cloud service
G212.7kLibraryintermediate8 days agoFront-end developers adding charts to a web dashboard
anime74.2kLibrarybeginner3 months agoFront-end developers adding motion to websites or web apps
mojs18.9kLibraryintermediate3 months agoFront-end developers who want decorative animated effects like bursts, shapes, or icon animations

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.