Why pasted text drags its formatting along, and why a blank notepad tab still beats it
You copy an address from a web page into an email. It lands in a different font, a size larger than the rest of your message, on a pale grey background, and when you press Enter after it, the next line inherits all of that too. You undo, try again, and get the same result. Eventually you do what people have done since the 1990s: open Notepad, paste it there, select it again, copy it again, and paste that. Now it behaves.
The Paste Notepad & Converter on this site is that detour turned into a page, and its opposite: a blank box that takes what you paste either as bare characters or with its formatting and pictures intact, plus the handful of things a scratchpad tab should do and web text boxes usually don’t. This post explains why the detour works in the first place, why web pages make a poor scratchpad by default, and what the notepad does about each problem.
What the clipboard actually holds
When you copy something, the program you copy from doesn’t put one thing on the clipboard. It puts the same content there in several formats at once, and leaves the choice to whoever pastes. A browser copying part of a web page typically offers:
- Plain text: just the characters, with line breaks where the browser thinks blocks end.
- HTML: the selected fragment of the page’s markup, with the styles that applied to it written inline, so it looks the same out of context.
- Sometimes rich text (RTF) or an image as well, depending on the system and what was selected.
The program you paste into looks at the menu and takes the richest format it understands. An email editor understands HTML, so it takes HTML, and with it the font family, the font size, the colour and the background of the page you copied from. Word does the same with RTF or HTML. Nothing is wrong: both programs are doing their best to preserve what you copied. It just isn’t what you wanted.
A plain text box can only accept plain text, so it takes that format and ignores the rest. When you copy from the text box again, the only thing on the clipboard is that plain text. That’s the whole trick: the intermediate stop throws away every format except one.
The same applies the other way round. Text copied out of a PDF often carries line breaks at the end of every printed line, and text copied from a spreadsheet arrives with tabs between the cells. A plain box shows you those characters exactly as they are, so you can see why the paste went wrong before you put it somewhere that hides them.
The notepad’s box does the opposite by default and keeps the formatting, for reasons the next sections come back to. The plain-text stop is one keystroke or one button away: Ctrl+Shift+V pastes the characters alone, and Remove formatting turns the whole note into them.
Why not just use “paste as plain text”?
Most programs now have a shortcut for exactly this: Ctrl+Shift+V in Chrome, Edge, Google Docs and many others; on a Mac it is often Cmd+Shift+Option+V. When it works, use it. It doesn’t always work:
- Some programs don’t have it, or bind the shortcut to something else.
- Some apply the destination’s formatting rather than none, which is fine in a document and wrong in a code editor that then auto-indents everything.
- It doesn’t help when you need to look at the text before using it: to delete the stray line numbers a code listing came with, to rejoin a paragraph a PDF broke into lines, or to pick three values out of a table row.
- It doesn’t help when the text has nowhere to go yet. Half of what goes into a scratchpad is waiting: a booking reference you’ll need in ten minutes, a password reset code you’re about to type, the address you’re reading off one screen to type into another.
For those, a blank page you can open in one keystroke is still the right tool. Which raises the next question: why not any web page with a text box on it?
When you want the formatting, pictures included
Just as often the formatting is the point. You want to collect a table from one page, a coloured status line from a dashboard and a screenshot of an error in one place before writing them up, or keep a few paragraphs of an email with their links working. A plain text box loses all of that.
A web page can offer the other kind of box too: an editable page, the same thing an online email editor is built on. Paste into it and the browser takes the clipboard’s HTML, so bold, italics, colours, headings, lists, links and tables all arrive, cleaned by the browser of anything that could run, such as scripts and onclick attributes. That is the notepad’s box. The box is always a white sheet, even in dark mode, because pasted text so often carries its own black or dark-grey colour that would vanish on a dark background.
Pictures need more care, because a picture on the clipboard can be three quite different things:
- A picture on a web page is part of the HTML: an
<img>tag with the picture’s address. It pastes as that tag, so it keeps showing for as long as the address works. - A screenshot, or a picture copied with “Copy image” in an app, is not HTML at all but an image file on the clipboard. The notepad reads it and writes it into the text as a
data:address, the picture’s bytes spelled out in text, so it lives inside the note. Image files dragged onto the box go in the same way. - A picture copied from Word or Outlook arrives as HTML pointing at a temporary file on your computer, something like
file:///C:/Users/…/clip_image001.png. Web pages are not allowed to open your files, so on its own that would paste as a broken picture. When the copy is just the picture, the clipboard holds the picture itself too, and the notepad puts it in the broken link’s place. When the copy is text with pictures in it, the clipboard’s image can be a snapshot of the whole selection rather than the picture alone, so the notepad leaves the paste as the browser makes it; copy such pictures separately.
The page around a paste doesn’t come along. Copy a whole landing page and its fixed header, sticky sidebar and 1,900-pixel-wide sections arrive as inline styles that would cover the notepad; the box flattens them, so everything pasted flows down inside it.
And when you want the plain-text detour after all, Remove formatting strips all of it at once, pictures included, which makes the same box the detour from earlier. It is a single edit, so Ctrl/Cmd+Z brings the formatting back.
The three things a web text box gets wrong as a scratchpad
Tab leaves the box
On the web, Tab belongs to keyboard navigation. It moves focus to the next link, button or field, and people who don’t use a mouse depend on that. So a normal text box never receives tab characters: press Tab to indent a line and the cursor jumps out of the box instead. That is annoying when you paste code, or try to line up two columns of numbers.
The notepad catches Tab and types a tab character, two spaces wide as in most code editors. But catching Tab unconditionally would trap anyone navigating by keyboard inside the box forever, which the web’s accessibility guidelines specifically call out as a failure (“no keyboard trap”). So Esc is the way out: after it, the next Tab moves forward and Shift+Tab backwards, as usual. As soon as you type again, the keys go back to editing. Without Esc, Shift+Tab works as it does in a code editor and takes one level of indent, a tab or two spaces, off the start of the line.
A small detail that matters more than it sounds: the tab is inserted through the browser’s own editing command rather than by rewriting the box’s contents, so Ctrl/Cmd+Z undoes it like any other keystroke. Pages that fake tabs by replacing the whole text tend to wipe out the undo history each time.
Closing the tab throws the text away
A scratchpad is precisely the tab you are most likely to close by accident. It has no name you recognise, it looks empty in the tab strip, and Ctrl+W is a reflex. Browsers give pages one tool here: a page can ask the browser to confirm before leaving. The page doesn’t get to write the question; for years now browsers have shown only their own generic “Leave site? Changes you made may not be saved” dialog, because pages used to abuse the custom text to keep people from leaving.
The notepad asks for that confirmation whenever the box holds anything other than whitespace, and never when it’s empty, so an unused notepad closes without fuss. Two caveats that come from the browsers, not the page. First, the question only appears after you have interacted with the page, which typing always counts as. Second, it doesn’t protect against everything: a browser crash, a phone discarding a background tab to free memory, or closing the whole browser window on some systems will still lose the text. If it matters, download it.
Thirty tabs, all called the same
Once you keep a scratchpad open while working, you have the opposite problem: finding it again. A tab titled “Notepad” looks like every other notepad tab you have open. So the notepad renames its tab as you type, to the first twenty characters of the text followed by the page name. A tab that holds a tracking number says so in the tab strip and in the browser’s tab search; two notepads with different notes in them are no longer twins.
A worked example
Say you are on a call and take this down, with the second and third lines indented by a tab:
Call back: Priya, re order #4471
Ref KX-2093-B
Phone 0151 4477 2210
Best after 3 pm
The tab title becomes Call back: Priya, re…: the first twenty characters, with the rest cut. The status line under the toolbar reads 16 words · 86 characters · 5 lines. Those numbers come from the same rules the page uses, run on the text above:
- 16 words. A word is anything between spaces, tabs and line breaks: six on the first line (
back:and#4471each count as one, punctuation included), two on the second (KX-2093-Bis one word), four on each of the last two. - 86 characters. Every letter, digit, punctuation mark, space, tab and line break counts once. The four line breaks and two tabs are six of them.
- 5 lines. The text ends with a line break, so, as in any code editor, there is a fifth, empty line after it where the cursor sits.
The note is plain text, so the button reads Download .txt, and the file is called Call back Priya re order 4471.txt: the first line with letters or digits in it, keeping only letters, digits, spaces, hyphens and underscores, so the colon (which Windows refuses in file names), the comma and the hash are gone. A note with no letters or digits at all saves as notepad.txt. Names are cut at 40 characters, and for a note that starts with HTML, the tags are left out: <h1>Price list</h1> saves as Price list.txt. A note with formatting or pictures in it, and anything in the HTML view, downloads as an .html file under the same rules, pictures included, so a version of this note with the name in bold would be Call back Priya re order 4471.html.
Character counts deserve one warning. The page counts characters the way Unicode numbers them, and some things that look like one character are built from several. A thumbs-up with a skin tone, 👍🏽, is two: the thumb and a modifier. Flags are two letters underneath, and family emoji can be seven or more. If you are writing to a strict limit, check how that limit counts: an SMS, for example, counts in its own units, in which one emoji takes two or more.
Seeing HTML instead of reading it
Above the box, Show as has an HTML button. Press it and a pane opens next to the note (under it on a phone) showing the note’s text as a rendered web page, updating as you type; press it again and the pane closes. The note itself never changes: the pane reads its characters, not its formatting. In a formatted note the button is offered only when the text has HTML tags in it, so the preview always starts from markup you can see rather than markup the clipboard wrote. It is meant for the moments when you have markup and want to know what it looks like: an email signature someone sent you as code, a block a CMS produced, a table a script generated, the source of a newsletter section you are about to paste into a template.
Rendering HTML that came from somewhere else is exactly how cross-site scripting attacks work, so the preview is built to keep it at arm’s length. It is not part of this page: the markup is handed to a separate frame as a document of its own, and that frame is sandboxed: the browser treats it as coming from nowhere, with no access to this site’s page, and with scripts switched off entirely. <script> tags, onclick and onerror attributes and forms simply don’t run. Markup and CSS do, including <style> blocks and inline styles, so the preview shows what the HTML and CSS alone produce. Links open in a new tab rather than inside the small frame.
The preview always shows a white page with the browser’s default styles, whichever colour scheme this site is shown in, because that is what a bare HTML document looks like. Two practical consequences of how browsers read HTML are worth knowing:
- Fragments are fine. You don’t need
<html>,<head>or<body>. Browsers are required to repair broken markup in a fixed, predictable way: they add the missing structure and close tags you left open. A lone<b>boldrenders as bold text, as it would on any page. - Addresses must be complete. An image written as
src="logo.png"would be looked up next to the notepad on this site, not on your computer or your own server. Use fullhttps://addresses for images and stylesheets.
If you want the HTML pane open every time, bookmark /developer/notepad-converter/?view=html. Neither that address, nor the full-window one, /developer/notepad-converter/?full=1, carries any text: the notepad always opens empty.
When the note is data
A scratchpad collects a lot of data in passing: an API reply copied from the browser’s network tab, a block of YAML from a config, a CSV export, a var_dump() from a log. Usually you need it in some other shape, JSON as YAML for a config file, a reply as a PHP array for a test, a serialized WordPress option as something you can read.
So next to HTML sit the data formats: JSON, XML, CSV, YAML, serialize(), PHP array, query string, Symfony’s dump() and var_dump(). On an empty page all of them work, ready for whatever you paste; after that they light up when the note’s text reads as data. Each opens a pane with the note in that format, and several can be open side by side, in as many Columns as you pick; Auto fits the screen, one column on a phone and up to four in a wide full window. Every pane has Copy and a download button that saves it as .json, .yaml, .csv, .xml, a .php file that returns the array, or .txt.
Not every format can hold every piece of data, and the buttons say so. A query string is a flat list of names and values; JSON has no way to write the INF a PHP dump can contain. A format that can’t hold what you pasted is greyed out, and text that isn’t data at all, a sentence or a lone number, leaves them all greyed out. The reading is done by the same code as the JSON / CSV / PHP Converter, on this site’s server: the notepad sends the note’s text as it changes, after a short pause, and shows the answer. Like the HTML pane, it reads the text and not the formatting, so JSON copied from a page that colours it works just the same.
Limits, and a few tips
- Nothing is kept between visits. The notepad has no saved notes, no history and no sync. Reload the tab and the box is empty again. That is the point of a scratchpad, but it means the confirmation dialog is the only safety net: use Download for anything you will want tomorrow.
- One note per tab. Need two? Open the page twice. Each tab names itself after its own text.
- Pictures make big notes. A pasted screenshot sits in the text as data, so a few of them make a large .html download and a very large file.
- Formatting is only what the clipboard offers. Some apps copy plain text only, and layouts such as columns, floating pictures and page backgrounds don’t survive in any web page.
- No scripts in the preview. Pages that draw themselves with JavaScript show only what their markup holds.
- Monospace for columns. The default font is a plain sans-serif, like a basic notepad. Tick Monospace to line up tab-separated values, code or anything where every character should be the same width.
- Full window for focus. Full window turns the page into nothing but the editor and its toolbar, and puts
?full=1in the address so a reload keeps it; Esc brings the page back. Add your browser’s own full-screen key (F11 on Windows and Linux) for a completely bare screen. - It still works without JavaScript, in a reduced way: there is only the plain text box, and Download .txt sends the text to the page and gets it back as a file. Formatting, tabs, the live counts, the tab title, the HTML and data panes and full window need JavaScript.
The habit the old Notepad detour built is a good one: put text somewhere neutral, look at it, then use it. The notepad just removes the part where you open a desktop program to do it. Open the notepad, paste, and close it when you are done; if you compare two versions of something you jotted down, the Text & Code Diff Checker is the next tool along.