A document, not a screenshot
Readable code from the first page to the last
Code2PDF turns source code into a real paginated document. Text stays selectable and searchable, while indentation, comments, blank lines, and syntax colors remain easy to review.
The editor and the PDF preview sit side by side, so you can catch wrapped lines and awkward page breaks before downloading. Choose A4 or Letter paper, light or dark syntax colors, margins, title, and page numbering.
Your source stays in the browser. The tool formats text only—it does not run the program, install packages, connect to a database, or validate whether the code is correct.
From editor to hand-in
Create a code PDF in three steps
Add your source
Paste a snippet, load an example, or open source files. Known extensions automatically select the matching language.
Set up the pages
Choose syntax colors, text size, line numbers, title, margins, paper size, and page numbers while watching the preview.
Download and submit
Inspect the actual page breaks, then download a searchable PDF that is ready for your course portal or report.
Built around student workflows
One clean artifact for every class
Use a PDF when instructors, teammates, or reviewers need a stable snapshot instead of a repository or editable source file.
Programming assignments
Add a clear title and line numbers, then submit consistent pages through an LMS or email.
Lab and project reports
Keep implementation excerpts searchable when they are attached to a larger report.
Reviews and portfolios
Share a focused class, query, script, or algorithm without exposing an entire repository.
The controls that matter
Format code without fighting a word processor
Code2PDF is intentionally narrow: it preserves source structure and gives you the page controls needed for a professional hand-in.
Language-aware color
Start in Code mode or switch among 21 programming, markup, data, shell, and plain-text modes.
Exact page preview
See the same A4 or Letter pagination that will appear in the downloaded PDF.
Useful document options
Control font size, title, line numbers, page numbers, theme, and margins independently.
Private by design
Source files and pasted code are processed locally without being sent to a conversion server.
Before you submit
Code to PDF questions
How do I convert code to PDF?
Paste your source or open a supported file, adjust the document settings, check the live preview, and select Download PDF.
Will the PDF contain selectable code?
Yes. The result is generated as a real PDF document rather than a screenshot, so code can be selected and searched.
Is my assignment uploaded?
No. Editing, preview rendering, and PDF creation happen locally in your browser. Normal website and CDN requests may still occur.
Does Code2PDF execute or check my program?
No. It formats source text only and does not compile, run, lint, test, or install dependencies.
Can I remove the title or line numbers?
Yes. The title, line numbers, and page numbers are independent options in the settings panel.
Which paper sizes are available?
You can choose A4 or US Letter and adjust the page margin before downloading.