SVG Editor online

Code

Export

Width and height stay in proportion. JPG has no transparency, so it always gets a background.

My drawings

Click a drawing to open it. They are stored only in this browser - nothing is uploaded. Clearing the browser's site data removes them, so download the ones you want to keep.

AI Assistant

Any AI can draw with you - ChatGPT, Claude, Gemini, Copilot.

  1. Click Copy prompt.
  2. Paste it into your AI and say what it should draw.
The AI should

The drawing travels in the link after the “#”, which no server sees. What you paste into your AI is handled by its provider.

Save to your server

The editor can send each saved version to your own server (a webhook), so your drawings are kept where you want them. Nothing is sent until you enter an address here.

What your server receives

A POST request with JSON (your server must allow CORS from https://svg.giit.ch):

{ "editor": "svg", "event": "save", "id": "…", "name": "Logo",
  "content": "<svg xmlns=\"http://www.w3.org/2000/svg\" …>…</svg>",
  "updated": "2026-01-15T09:30:00.000Z" }
Embed the editor in your website
<iframe src="https://svg.giit.ch/?embed=1" style="width:100%;height:80vh;border:0"></iframe>
<script>
const frame = document.querySelector('iframe');
addEventListener('message', e => {
  if (e.origin !== 'https://svg.giit.ch' || e.source !== frame.contentWindow) return;
  if (e.data.type === 'svgeditor:ready')
    frame.contentWindow.postMessage({ type: 'svgeditor:load', name: 'Logo',
      content: '<svg …>…</svg>' }, 'https://svg.giit.ch');
  if (e.data.type === 'svgeditor:save') saveOnYourServer(e.data.content);
});
</script>

Also possible: ?src=<URL of an .svg file> opens a file, &webhook=<URL> saves this drawing there. The editor can also open in a window of its own (?embed=window), and your page can hand it its own AI prompt and a session key so the AI sends its result to your server (svgeditor:ai, svgeditor:key-request) - see "Use the editor on your own website" below the editor. Details are in llms.txt.

Help

How it works

  1. Open an SVG file, drag it into the window or paste SVG code - or start with New.
  2. My drawings (the folder button at the top left) lists every drawing kept in this browser: open, rename, duplicate, download or delete them.
  3. Click a shape on the canvas. Drag it to move it, drag the small squares to resize it. Colors, size and position are under Properties on the right.
  4. Draw new shapes with the tools above the canvas.
  5. The code on the left always shows the current drawing and can be edited directly.
  6. Download SVG saves the file, Export offers pictures (PNG, JPG) and code for websites.

Made a mistake? Undo takes back every step. Your drawings are kept in this browser, even after closing the page.

Keyboard shortcuts

V
Select and move
R E L P T
Rectangle, ellipse, line, freehand, text
H / hold Space
Move the view
Mouse wheel, + -
Zoom
Drag with the mouse wheel pressed
Move the view
Double-click the mouse wheel
Fit to window
0 / 1
Fit to window / actual size
# / G
Grid on/off / snap on/off
Arrow keys
Move the selection by 1, with Shift by 10
Shift while dragging
Only horizontal/vertical, keep proportions
Alt + click
Select the surrounding group
Delete
Remove the selection
Ctrl + D
Duplicate
Ctrl + ↑ / ↓
Forward / backward (with Shift: to front / to back)
Ctrl + Z / Y
Undo / redo
Ctrl + S / E
Download SVG (or save to your server) / export
Ctrl + O
My drawings
Esc
Deselect

In the code: Tab indents, Shift+Tab outdents, clicking into a tag selects that shape on the canvas.

SVG をオンラインで表示、編集、エクスポート

SVG エディターは、図とそのコードを並べて表示します。コードの変更はすぐにプレビューに反映され、キャンバス上で移動、サイズ変更、色変更した内容はコードに反映されます。大きなグラフィックソフトを開かなくても、アイコン、ロゴ、グラフ、イラストをすばやく調整できます。

すべてブラウザー内で動作します。ファイルはアップロードされず、登録も広告もありません。

エディターでできること

ハイライト付きのコード

タグ、属性、値を色分けし、行番号、Tab によるインデント、タグの自動補完、行番号付きのわかりやすいエラーメッセージを備えています。

図形を直接編集

長方形、円、パス、多角形、テキスト、グループを、クリック、ドラッグ、ハンドルでのサイズ変更、回転、反転、複製、前面・背面への移動で編集できます。

色と線

カラーピッカーまたは値で指定する塗りと線、不透明度、線の太さ、破線、丸または四角の線端。

スナップ付きのグリッド

図自体の座標で任意のグリッド間隔を設定できます。図形はグリッド線にぴったり吸着します。「スナップ」のチェックを外すと自由に動かせます。

描画ツール

長方形、楕円、円、線、フリーハンド、テキスト。新しい図形の色も選べます。

エクスポート

SVG (書いたまま、整形、縮小)、透明な背景の PNG、JPG、WebP、データ URI、Base64、CSS、React コンポーネント。

使い方

  1. SVG を開く - ファイルを選ぶか、ウィンドウにドラッグするか、コードを貼り付けます。
  2. 編集 - コードを入力するか、キャンバスで図形をクリックしてドラッグし、右側で色を設定します。
  3. エクスポート - 形式を選び、画像ならサイズを設定して、ダウンロードまたはコピーします。

エディターを自分の Web サイトで使う

https のページ (および localhost) なら、<iframe> と ?embed=1 でエディターを埋め込めます。登録もキーも不要です。埋め込まれたエディターはこの説明文を隠し、保存ボタンを表示します。図を受け渡す方法は 2 つあります。

1. リンクからファイルを開き、自分のサーバーに保存する

src= でファイルを開き (サーバーで CORS の許可が必要)、webhook= を指定すると「保存」(Ctrl+S) で図がそのアドレスに送信されます。&token=… を付けると Authorization: Bearer … ヘッダーが付き、&auto を付けると変更のたびに保存します。

<iframe src="https://svg.giit.ch/?embed=1&src=https://your-site.com/docs/logo.svg&webhook=https://your-site.com/save.php"
        allow="clipboard-write" style="width:100%;height:800px;border:0"></iframe>

Webhook は JSON { editor, event: "save", id, name, content, updated } を含む POST を受け取ります。それを保存する小さな PHP スクリプト:

<?php
header('Access-Control-Allow-Origin: https://svg.giit.ch');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
header('Access-Control-Allow-Methods: POST, OPTIONS');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') exit;
if (($_SERVER['HTTP_AUTHORIZATION'] ?? '') !== 'Bearer SECRET') { http_response_code(403); exit; }
$d = json_decode(file_get_contents('php://input'), true);
$name = preg_replace('/[^\w\- ]/u', '_', $d['name']);
file_put_contents(__DIR__ . "/docs/$name.svg", $d['content']);
echo '{"ok":true}';

2. ページが図を保持する (postMessage)

エディターが svgeditor:ready を送り、ページが svgeditor:load で応答すると、エディターは svgeditor:loaded を返し、実際に編集されると svgeditor:change、ユーザーが保存すると svgeditor:save を送ります。ページからは svgeditor:get (現在の状態) や svgeditor:save (保存ボタンを押す) を送れます。保存はあなた自身のログインとセッションを通して行われます。

<iframe id="ed" src="https://svg.giit.ch/?embed=1" allow="clipboard-write" style="width:100%;height:800px;border:0"></iframe>
<script>
const ed = document.getElementById('ed');
const ORIGIN = 'https://svg.giit.ch';

addEventListener('message', async e => {
  if (e.source !== ed.contentWindow || e.origin !== ORIGIN) return;
  const m = e.data;
  if (m.type === 'svgeditor:ready') {             // エディターの準備完了: 図を渡す
    ed.contentWindow.postMessage({
      type: 'svgeditor:load',
      name: 'Logo',
      content: await (await fetch('/docs/logo.svg')).text(),
    }, ORIGIN);
  }
  if (m.type === 'svgeditor:change') document.title = '● not saved';   // 実際の編集
  if (m.type === 'svgeditor:save') {              // ユーザーが「保存」をクリックした
    await fetch('/api/save', { method: 'POST', headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ name: m.name, content: m.content }) });
    document.title = 'Saved';
  }
});

// 自分のページの保存ボタン: 応答は svgeditor:save として届く
function saveNow() { ed.contentWindow.postMessage({ type: 'svgeditor:get' }, ORIGIN); }
</script>

ページ内の AI アシスタント: フレーム内でも動作します。iframe に allow="clipboard-write" を付けると、「プロンプトをコピー」がクリップボードを直接使います (付けない場合は古いコピーコマンドを使うか、手動でコピーできるようプロンプトを表示します)。AI が送るリンクはほかの Web サイト内のエディターには届かないため、エディターは AI とユーザーに、代わりに AI の回答全体をエディターに貼り付けるよう案内します。または、エディターを専用のウィンドウで開いてください。

3. 専用のウィンドウで開く

window.open("https://svg.giit.ch/?embed=window", "svgeditor-17") は完全なエディターを専用のウィンドウで開き、window.opener と同じメッセージをやり取りします。AI からのリンクもそこに届きます。svgeditor:load には context: { host, title, rules } (AI プロンプトが図の所属先を伝え、あなたのルールに従います) と hook: { url, token } (この図専用で保存されない Webhook) も含められます。未保存の変更があるままウィンドウを閉じると svgeditor:closing が送られます。

4. 自分のサーバー経由の AI

エディターに独自のプロンプト、サイト上のアドレス、このエディターセッション用のキーを渡します。すると AI ダイアログには、あなたのサイトへの「接続先」、AI に伝える内容、そして 現在の図を変更 か 新しい図を作成 の選択肢が表示され、プロンプトをコピー ですべてがまとめられます。AI はキーを付けて結果をあなたのサーバーに送り、ページがそれをエディターで開きます。新しい図は別に開き、ユーザーのブラウザー内に残ります。キーはエディターセッションごとに 1 つです。エディターを開いている間は有効で、キーがないときだけエディターが svgeditor:key-request で要求します。エディターがキーを自分で送ったり保存したりすることはありません。アドレスはあなた自身のホストまたはそのサブドメイン上の https である必要があります。

const key = async () => (await fetch('/api/ai-key.php?doc=17')).json();   // エディターセッションごとにキーを 1 つ
const k = await key();
ed.contentWindow.postMessage({ type: 'svgeditor:load', name: 'Flyer', content, ai: {
  label: 'My Site', prompt: 'Keep the [[placeholders]]. Write in German.',
  endpoint: 'https://your-site.com/api/ai-result.php', key: k.key } }, ORIGIN);
// svgeditor:loaded の id を覚えておき、別の id の change/save/closing は無視する
// エディターにキーがないときだけ:
if (m.type === 'svgeditor:key-request') { const k = await key(); ed.contentWindow.postMessage({ type: 'svgeditor:ai', key: k.key }, ORIGIN); }
// エディターを開いている間、毎分サーバーに知らせる。エディターまたはページを閉じるとキーは無効になる
setInterval(() => fetch('/api/ai-key.php?alive=' + k.key.slice(0, 8)), 60000);
// サーバーに結果がある (ポーリング、SSE …): target は "current" または "new"
ed.contentWindow.postMessage({ type: 'svgeditor:load', name: 'Flyer', content: draft, from: 'ai', target }, ORIGIN);
<?php // api/ai-key.php - ログイン中のユーザーのこのエディターセッションのキー (ページから呼び出す)
session_start();                                     // ユーザーがこの図を編集できるか確認する
$key = bin2hex(random_bytes(24));
$_SESSION['ai'][hash('sha256', $key)] = ['doc' => (int)$_GET['doc'], 'seen' => time()];  // またはデータベースに保存。?alive= で seen を更新する
echo json_encode(['key' => $key]);

<?php // api/ai-result.php - AI がここに POST する (CORS ヘッダーなし: AI はサーバーから呼び出す)
$key = preg_replace('/^Bearer\s+/', '', $_SERVER['HTTP_AUTHORIZATION'] ?? '');
$row = find_key(hash('sha256', $key));               // データベース: 無効になっておらず、直近 3 分以内に seen があるもの
if (!$row) { http_response_code(401); exit('{"ok":false,"error":"key not valid"}'); }
$d = json_decode(file_get_contents('php://input', false, null, 0, 2000000), true);
save_draft($row['doc'], $d['content'], $d['target'] === 'new' ? 'new' : 'current');   // ページが svgeditor:load で表示する
echo '{"ok":true}';

キーは 128 ビット以上のランダム値で作り、ハッシュだけを保存し、それぞれをログイン中のユーザー、図、このエディターセッションに結び付けてください。キーはセッションごとに 1 つ作り、ページがセッションを開いていると報告している間だけ有効にし、エディターまたはページが閉じたら無効にしてください。

プロトコルの全体は llms.txt にあります。AI に渡せば、あなたのシステム用の接続を作ってくれます。LaTeX エディターも接頭辞 latexeditor: で同じように動作します - latex.giit.ch。

よくある質問

SVG ファイルはアップロードされますか?

いいえ。エディターは完全にブラウザー内で動作します。開いたファイルやコードがサーバーに送られることはなく、下書きはブラウザーのローカルストレージにだけ保存されます。

図はどこに保存されますか?

ブラウザー内だけです。エディターはそこに図をいくつでも保管できます。左上のフォルダーボタン (マイドローイング) をクリックすると、開く、名前の変更、複製、ダウンロード、削除ができます。何もアップロードされません。ブラウザーのサイトデータを消去すると削除されるので、残したいものはダウンロードしてください。

SVG を PNG に変換するには?

SVG を開くか貼り付けて「エクスポート」をクリックし、PNG を選んでサイズ (1×、2×、4× または任意) を選び、「ダウンロード」をクリックします。色を選ばない限り、背景は透明のままです。

マウスで図形を編集できますか?

はい。図形をクリックすると選択されます。ドラッグで移動、小さな四角でサイズ変更、回転、反転、色の変更ができます。左側のコードも一緒に変わります。

グリッドは何をしますか?

グリッドは図自体の座標でガイド線を表示します。オンのときは、移動したり描いたりした図形がグリッド線にぴったり吸着します。「スナップ」のチェックを外すと、グリッドを表示したまま図形を自由に動かせます。

SVG を React コンポーネントとして使えますか?

はい。エクスポートで「React コンポーネント (JSX)」を選びます。stroke-width などの属性は strokeWidth に、class は className になり、コンポーネントはほかの props も受け付けます。

AI に SVG エディターで描いてもらえますか?

はい、どの AI でも使えます。ChatGPT、Claude、Gemini、Copilot、またはコーディングツールの AI です。「AI アシスタント」、続いて「プロンプトをコピー」をクリックし、AI に貼り付けて何を描くか伝えてください。AI はリンクで回答します。クリックすると図がエディターに表示されます。開いている図を変更することも、ほかの図と並べて新しい図を作ることもできます。インストールは不要で、「元に戻す」ですべての変更を戻せます。

エディターを自分の Web サイトで使えますか?

はい。iframe で埋め込んで postMessage で図をやり取りするか、Webhook で保存した版をすべて自分のサーバーに送れます。例は エディターを自分の Web サイトで使う をご覧ください。

SVG エディターは有料ですか?

いいえ。エディターは無料で、広告も登録もありません。