HTML Link Code Generator
HTML link code generator and viewer. Pick a link type — text, image, email or named anchor — set the normal and hovered CSS styles, and get ready-to-paste HTML link code with a live preview of the result.
Generated link view:
The live preview of your link appears here after Generate.
HTML Link Code Generator builds ready-to-paste HTML link code: pick a link type (text, image, email or named anchor), set normal and hovered CSS styles (color, background, underline, target), then press Generate and copy the result. Everything runs in this browser tab — nothing is uploaded to a server.
Choose the link type
Select Text link, Image link, Email link or Named anchor link. Fill the two fields it asks for: link text and URL, image URL and URL, an email address, or the link text and an anchor name.
Set the CSS styles
Under Normal link and Hovered link, choose color and background-color from the 17 named colors or type a hex code, toggle the underline text-decoration, and pick target-new (none, tab or window) for how the link opens.
Generate, view, copy
Press Generate. The snippet appears under “Generated link code:” (a <style> block with a:link and a:hover rules only when you set styles, plus the <a> markup), and the “Generated link view:” shows the live result. Press Copy code to paste it into your page.
Rules at a glance
- Hex codes accept 3 or 6 digits with an optional leading #, case-insensitive —
#FFD700becomes#ffd700in the output. - A named color wins over a typed hex code in the same color picker; the hex box only matters when the picker is on “- hex code -”.
- The
<style>block is only emitted when you actually set a color, a background, or turn the underline off. - target-new tab emits
target="_blank"; window addsrel="noopener"; the target comes from the Normal link section (browsers cannot change a link target on hover). - Invalid input is caught before anything is generated: a missing field, a bad email address, a malformed hex code, or an anchor name containing spaces or quotes shows an inline error and keeps your previous code untouched.
Frequently asked questions
- Does an email link hide my address from spam bots?
- No. A mailto: link is plain HTML and bots can read it like any other link — the generator produces honest, standards-based code, nothing more.
- What does the Named anchor link type produce?
- Two lines: a link that jumps to the anchor (<a href="#name">…) and the anchor definition itself (<a name="name">…). Put the second line where the section you want to jump to begins.
- Why is there no style block in my generated code?
- The generator keeps output minimal: with no colors, no background and the default underline, no CSS is needed at all — the bare <a> tag is complete.
- Is my text or URL uploaded anywhere?
- No. The whole tool runs in your browser tab; the code is assembled locally and only you copy it out.
- Can I preview the link before using it?
- Yes — the “Generated link view:” box renders your exact generated markup in an isolated frame, so the colors and underline you chose show up live without touching the rest of the page.
Privacy: this generator runs entirely in your browser tab. Nothing you type is uploaded to a server — the link code is built locally with JavaScript and stays on your device until you copy it.