How to copy code from VS Code to your phone without autocorrect breaking it
Pasting code into phone chats usually breaks indentation, turns symbols into emoji, and capitalizes words randomly. QR Codes solve it — with a workaround for longer snippets.
You're debugging something in VS Code, want to show it to a colleague who's only on their phone. You paste the block into WhatsApp… and autocorrect turns const into Const, function into Function, and the @ for a decorator becomes an emoji. The indent also gets lost because the app converted tabs into spaces.
Two problems are happening:
- Autocorrect: iOS and Android "help" by fixing words they think are wrong
- Formatting: line breaks and tabs/spaces can be reinterpreted by the destination platform
Why pasting code into chat is fragile
Code is literal. A missing < breaks HTML. A [ swapped for { breaks JSON. The text needs to arrive bit-for-bit identical to the original. Any platform that processes text (autocorrector, markdown renderer, inconsistent UTF-8 encoding) messes it up.
Platforms that break code
- WhatsApp: converts URLs to previews, sometimes breaks indent
- Slack: if you don't use triple backticks
```, applies emoji substitution - Email: Gmail web forces word-wrap, Outlook adds blank lines between paragraphs
- SMS/iMessage: aggressive autocorrect
Solutions, best quality last
Solution 1: GitHub Gist
The correct way for bigger snippets. Create the gist (public or secret), copy the URL, send it. But you need to log in, and it's a hassle for a 3-line snippet.
Solution 2: Pastebin (or similar)
Faster than gist. But leaves the code on a third-party server indefinitely — bad for snippets with credentials, tokens, or proprietary IP.
Solution 3: QR Code with raw text
For short snippets (up to ~300 characters), generating a local QR Code with the code is the cleanest path. The flow:
- Select the block in VS Code (
Cmd/Ctrl + Ainside the snippet) - Copy
- Open PasteQRCode
- Paste — the QR appears instantly
- Show the PC screen, point the phone's native camera
- Tap the notification, copy to the destination (Notes, Slack, whatever)
The key point: the QR Code encodes the text as pixels. No autocorrect is possible — characters arrive identical to what you typed. Indent preserved, symbols preserved, UTF-8 preserved.
Solution 4: QR Code with temporary link (longer snippets)
For a whole 50-line file, a direct QR Code gets too dense for the camera to read. Modern generators detect this and:
- Save the text to a temporary store (5-15 min)
- Generate a short URL like
pasteqrcode.com/en/t/a1b2c3 - The QR points to that link
- Phone scans → opens a page with the text formatted in
<pre>(no autocorrect possible) - A "copy" button on the page — clean text, ready to paste
After the 5-15 min window, the text disappears from the server automatically.
Practical example
Suppose you want to show this snippet to a colleague:
const config = {
api: "https://api.example.com",
timeout: 5000,
retries: 3
};
That text is ~100 characters. A direct QR Code handles it no problem. Paste into the generator, show the screen, colleague scans, opens in Notes/Stickies on their phone. Zero autocorrect along the way.
Extra tips for code in QR
- Preserve the original indent: if you use tabs, keep tabs. If you use 2 spaces, keep 2. The QR respects it.
- Don't copy giant comments: every character counts toward the QR size. Strip heavy JSDoc first.
- Test on your own phone first: scan it before showing to someone.
- For very long code: prefer gist or save as a file and use AirDrop / Nearby Share.
FAQ
What about 1000+ lines of code? Gist is better. QR Codes are for snippets that would fit on a sticky note.
Does the QR preserve Chinese characters / emoji? Yes. It's UTF-8 by default.
Does the phone paste with formatting? Depends on the target app. iOS Notes.app preserves indent. WhatsApp sometimes re-autocorrects on paste. Use a neutral app (Notes, Notion) as an intermediary.
Summary
To move short VS Code snippets to your phone, a local QR Code keeps formatting intact and avoids autocorrect. For longer snippets, a temporary link that vanishes in minutes combines privacy with a readable QR size. For permanent code, gist is still the standard.
Keep reading
How to share long links from your PC to your iPhone without any app
Three fast ways to open a desktop link on your iPhone — including the one that takes 3 seconds, needs no email, no WhatsApp, and no signup.
How to share API keys safely without using WhatsApp
Sending tokens, passwords and API keys through WhatsApp is the most common — and the worst — way security-wise. Here are four alternatives that leave less trace.
How to transfer a Wi-Fi password between phones in 10 seconds
iPhone shares Wi-Fi with iPhone natively. Android shares with Android. When the guest has the other OS, a QR Code solves it in seconds.