Share a code snippet
The fastest way to get another person to look at your code is a link that opens to exactly that code, with indentation intact and line numbers on the left. Not a screenshot, not an attachment, not a repository they have to clone.
Create the snippet
- Paste the code into the editor at pastesite.com.
- Pick the language from the Language list — JavaScript, TypeScript, Python, Bash, SQL, Go, Rust, Java, C/C++, PHP, Ruby and more. Highlighting is cosmetic; the text is stored exactly as typed.
- Give it a title that names the problem, not the file: "TypeError when parsing empty JSON body" beats "test.js".
- Set an expiry if this is a one-off debugging exchange. Use unlisted if the code is not for the public feed.
- Create and send the link. Anyone can read it without an account.
Getting it back out
Every paste has two views. The formatted page is for humans; /raw/<id> returns the exact text as text/plain with no HTML wrapper, which is what you want inside a script:
Download a paste into a file
curl -s https://pastesite.com/raw/AbC123xYz9 > snippet.py
python snippet.py
Password-protected pastes accept ?password=... or an x-paste-password header on the raw endpoint. The API guide covers creating pastes from a terminal with an API key.
What to include in the snippet
- The failing part plus a little context. Five lines of imports beat a whole file.
- The error message, verbatim. Paraphrasing an error hides the exact string someone would search for.
- What you expected. "Should return [] for an empty array" tells the reader where to look.
- Versions when they matter. Node 18 versus 22, Python 3.11 versus 3.13, a specific React minor.
- Nothing secret. No API keys, tokens, connection strings, customer data or internal hostnames.
Sharing a diff instead of a file
For review, a unified diff is more useful than the changed file. Choose Diff / Patch as the language and paste the output of git diff. The + and - lines get coloured, so the reader sees the change without reconstructing it.
Produce a readable patch
git diff --stat
git diff -U5 -- src/parser.ts
If you want to compare two versions of a snippet before sending, the text comparison tool runs entirely in your browser.
Frequently asked questions
Which languages get syntax highlighting?
Over 30: JavaScript, TypeScript, Python, Bash, SQL, JSON, CSS, HTML, XML, YAML, TOML, Markdown, Diff, Dockerfile, C, C++, C#, Java, Kotlin, Swift, Go, Rust, PHP, Ruby, Lua, Perl, R, Scala, Dart, PowerShell and plain text.
Does the code run on the server?
No. Pastes are stored and displayed as text. Nothing is executed, evaluated or interpreted, which is also why sharing a snippet cannot do anything to the reader.
Can I get the code without the HTML page?
Yes — /raw/<id> returns plain text, suitable for curl, wget and shell pipelines.
Is a paste a good place for a whole repository?
No. A paste is one block of text with a 100,000 character limit. Use git for anything with more than a couple of files or any history.