You enter a hex code in Adobe Illustrator by typing it into the color field of the Color Picker or the Color panel with the number sign included—for example, #1E90FF. Illustrator accepts the six-digit RGB form everywhere a hex value is allowed; the three-digit shorthand and eight-digit alpha form are not reliably accepted in every field, so spell them out as six digits. The key condition is that the document color mode and the specific field you use must both support RGB-style hex input. Hex is an RGB notation, so it works directly in RGB documents and converts automatically in CMYK documents, with a color shift you should expect. This guide walks through every place you can paste a code, what each field accepts, and how to confirm the color landed correctly.

The single most common failure is typing the code without the # or pasting a value that carries hidden spaces from a website or design handoff. A second common failure is looking for the hex field in the Swatches panel, which has none. Knowing where the field lives in each panel saves more time than memorizing shortcuts.

What a hex code actually is, and why Illustrator asks for RGB

A hex code is a base-16 way of writing three RGB channel values. Each channel—red, green, and blue—gets one byte, which ranges from 0 to 255. In hex, 255 is FF, and 0 is 00. So a six-digit code is three pairs: RRGGBB. #FF0000 is red at full strength with no green or blue; #000000 is black; #FFFFFF is white.

Because hex is built from RGB bytes, Illustrator treats it as an RGB color definition. That has three practical consequences:

1: In a document whose color mode is RGB, the hex value maps one-to-one onto the channel sliders, and what you type is what you get numerically. 2: In a CMYK document, Illustrator converts the RGB value into the document's CMYK working space. The numbers will no longer match the hex code, and the on-screen color may drift slightly. This is normal color management behavior, not an error. 3: In a document with a grayscale color mode, hex input still works in the picker but the result collapses to a gray tone, so the hue information is lost.

If you need the hex value to survive unchanged—say, for a web or app handoff—work in an RGB document, or keep a separate RGB artboard or swatch library for screen assets. For print work, the hex code is usually just a starting point that gets converted to CMYK or a spot color anyway.

One more definition matters: the # character. Illustrator's color fields are lenient in some places and strict in others. In the Color Picker's hex box, you can type six digits with or without the # and it usually resolves correctly. In the Color panel's flyout and in the New Swatch dialog, including the # is the safer habit because it unambiguously signals a hex string rather than a name or a number.

Before you start: mode, panel, and selection checks

A few prerequisites prevent most confusion:

Know your document color mode. Check the document tab or go to File > Document Color Mode. The menu shows which mode is active and lets you switch. Switching modes on an existing document remaps existing colors, so do it before you build the palette, not after. Have something selected, or plan to create a swatch. If you type a hex code into the Color panel with no object selected, you change the default fill/stroke for new objects rather than any existing artwork. With an object selected, the change applies to that object's active fill or stroke. Decide whether you want a one-off color or a reusable swatch. A hex code typed into the Color Picker changes one object's color. A hex code entered in the New Swatch dialog creates a named, reusable color you can apply across the document. Clear stray characters from pasted codes. Codes copied from CSS, Figma, or a brand guide often arrive with a leading space, a trailing semicolon, or lowercase letters. Illustrator tolerates lowercase, but spaces and punctuation cause rejection.

Entering a hex code with the Color Picker

The Color Picker is the fastest route for recoloring a single object. It is a modal dialog, so you finish and confirm before returning to the canvas.

1: Select the object you want to recolor with the Selection tool. 2: Click the Fill or Stroke swatch in the Tools panel or the Properties panel to target the attribute you want to change. Double-clicking the swatch opens the picker directly. 3: The Color Picker opens. Near the bottom, find the field labeled with a # and a six-character box. That is the hex field. 4: Click into the hex field, select any existing text, and type your code, for example #2E8B57. Keep the # if the field displays one; if you delete it, type six digits only. 5: Press Tab or Enter to commit the value. The picker previews the color immediately in the swatch at the top and in the canvas behind the dialog if preview is enabled. 6: Click OK. The object takes the new color.

What to expect: The RGB sliders jump to the matching values, and the CMYK fields show the converted equivalent if the document is CMYK. Expect the CMYK numbers to be approximate—Illustrator rounds to whole percentages, so the conversion is not perfectly reversible.

How to check success: Reopen the picker on the recolored object. The hex field should show the same code (uppercase or lowercase depending on how you typed it). If the field shows a different value, the document's color mode converted your color on commit, which happens in some CMYK workflows.

Common failure: If the field refuses your keystrokes, you may be typing into the wrong box—some pickers have separate fields for H, S, B and R, G, B. The hex field is the one with the # label. If the value reverts after you press Enter, the string likely contains a space or a non-hex character.

Entering a hex code through the Color panel

The Color panel is better for iterative work because it stays open and lets you nudge values. The hex entry lives in the panel's flyout menu rather than on the panel face, which is why people miss it.

1: Select the object and target Fill or Stroke in the Color panel. 2: Open the Color panel from Window > Color if it is not visible. 3: Click the panel menu icon (the small hamburger or triangle in the panel's upper-right corner) and choose RGB Color from the list so the panel shows R, G, and B fields. Hex entry works in other modes too, but RGB makes the mapping visible. 4: From the same panel menu, choose Show Options if the panel is collapsed to a single row; the options area is where the fields appear. 5: In the options area, locate the hex field, usually at the bottom of the panel next to a # label. 6: Type your six-digit code and press Enter. The sliders update and the selected object recolors live. 7: If you want to keep the color, click the New Swatch button at the bottom of the Swatches panel, or drag the color from the Color panel's swatch square into the Swatches panel.

What to expect: The change applies immediately with no OK button. This is convenient but also means a mistyped code briefly flashes on your artwork—easy to undo with Ctrl+Z or Cmd+Z.

How to check success: The hex field should retain your value, and the R, G, B sliders should show the decimal equivalents. For #2E8B57, the channels are 46, 139, and 87. If the sliders show those numbers, the entry took.

Creating a reusable swatch from a hex code

Swatches are how a hex palette becomes a system rather than a series of one-off clicks. The New Swatch dialog has a dedicated hex field, and it is the most reliable place to enter codes because it validates the string before creating anything.

1: Open the Swatches panel from Window > Swatches. 2: Click the New Swatch button at the bottom of the panel, or choose New Swatch from the panel menu. 3: In the New Swatch dialog, name the swatch—brand names like "Primary Blue" or the code itself both work. 4: Set Color Type to Process Color for standard CMYK/RGB output, or Spot Color if the color must map to a named ink. Hex input is most natural with Process Color. 5: Set Color Mode to RGB, then find the hex field near the bottom of the dialog. 6: Type the six-digit code and press Tab. The preview swatch and the slider values update. 7: Click OK. The swatch appears in the Swatches panel and can be applied to any object with a single click.

What to expect: The swatch stores the converted values for the document's color mode. In a CMYK document, the stored CMYK numbers are the converted approximation, and the hex field in the swatch options will show a value that may differ slightly from what you typed.

How to check success: Double-click the new swatch to reopen Swatch Options. The hex field should show your code, or a very close converted value in CMYK documents. Apply the swatch to a test rectangle and reopen the Color Picker to compare.

A useful variant: If you have a list of brand hex codes, create the swatches in a small batch—one dialog per color—and then save the group as a swatch library via Save Swatches in the Swatches panel menu. That library can be loaded into future documents, which keeps a hex palette consistent across a project.

Pasting hex codes from other apps without breaking them

Hex codes rarely originate in Illustrator. They come from CSS, a Figma inspect panel, a brand PDF, or a chat message. Three paste habits prevent most failures:

Strip the decoration. Remove semicolons, quotes, rgb() wrappers, and trailing spaces. A CSS declaration like color: #1E90FF; must become #1E90FF before it goes into any Illustrator field. Expand shorthand. A three-digit code like #09F means #0099FF. Illustrator's fields generally expect six digits, so expand shorthand manually rather than trusting the field to interpret it. Drop alpha. An eight-digit code like #1E90FFCC includes an alpha channel. Illustrator's standard color fields do not accept an alpha suffix; use the first six digits and set opacity separately in the Transparency panel.

Failure case worth knowing: Pasting a code that begins with a space sometimes shifts the string so the field reads only five valid digits and one space, and Illustrator silently keeps the previous color. If a paste appears to do nothing, click into the field, select all, and retype by hand. That check takes five seconds and resolves the majority of "it won't accept my code" reports.

Reading hex back out of existing artwork

The reverse operation—finding the hex value of a color already in the file—uses the same fields in reverse. Select the object, open the Color Picker or the Color panel's hex field, and read the six-digit string. In CMYK documents, the displayed hex is the RGB interpretation of the converted CMYK values, so it will not match the original brand hex exactly.

This is the practical limit of hex in print workflows: once a color is converted to CMYK, the original hex is no longer stored in the object. If exact brand hex values matter, keep a swatch library built from the original codes and treat the artwork as a rendering of that library rather than the source of truth. For screen deliverables, stay in RGB mode throughout and the round trip stays clean.

Troubleshooting by symptom

The hex field rejects keystrokes. You are probably in a numeric field rather than the hex field, or the field is disabled because the color type is set to a spot or global color that does not accept direct hex entry. Switch the color type to Process and try again.

The color applies but looks wrong on screen. Check the document color mode and the assigned color profile. A CMYK document with a proofing setting enabled can display colors differently from the raw values. Turn off Overprint Preview and any proof simulation to see the working-space color.

The code works in the picker but not in the swatch dialog. The dialog may be set to a color mode that hides the hex field, or a spot color type is selected. Set Color Mode to RGB and Color Type to Process.

The value changes after you click OK. In CMYK documents, the conversion to CMYK rounds the values, so reopening the picker shows a slightly different hex. This is expected; the object now holds CMYK values, not your original RGB string.

The hex field is missing entirely. Panel workspaces can hide options. Choose Show Options from the Color panel menu, and make sure the panel is not in a collapsed state. In the Color Picker, the hex field is always present near the bottom.

You need to stop and get help. If codes fail across multiple documents, panels, and freshly created files, the installation or preferences may be damaged. Resetting Illustrator preferences is a standard, reversible first step; if the problem persists after a reset, contact Adobe support rather than continuing to rebuild panels by hand. That is the practical stop condition for this workflow.

Quick reference: field behavior at a glance

Location Accepts #? Accepts 3-digit shorthand? Applies live? Best for
Color Picker hex field Yes, optional Not reliably Preview only One-off recolors
Color panel hex field Yes, recommended No Yes Iterative tuning
New Swatch dialog Yes, recommended No No, on OK Building palettes
Swatch Options (edit) Yes No On OK Correcting a saved swatch

The table summarizes field behavior rather than promising identical behavior across Illustrator versions; panel layouts have shifted over the years, and the hex field has moved within the Color panel in some releases. If your panel looks different from the steps above, the panel menu's Show Options command is the first thing to try.

Keeping hex values honest across a project

The workflow that holds up over time is simple: build a swatch library from the original hex codes, work in RGB for anything destined for screens, and switch to CMYK only when the print deliverable requires it, accepting the conversion drift. Enter codes through the New Swatch dialog when they need to persist, and through the Color Picker when they are one-off experiments. Check every entry by reopening the field and comparing the six digits—that single verification step catches paste errors, silent conversions, and mistyped characters before they propagate through a document. Hex entry in Illustrator is not complicated; it is just easy to do in the wrong field. Match the field to the job, include the number sign, and verify once.